FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour List of existing variables used
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
List of existing variables used
Posted: Thu Jul 09, 2015 12:38 PM

Hello,

Is there any possibility to generate automatically a list of all just variables, local, public as well as private variables?

Thanks.

Regards,

Michel D.
Genk (Belgium)


_____________________________________________________________________________________________

I use : FiveWin for (x)Harbour v. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: List of existing variables used
Posted: Thu Jul 09, 2015 02:03 PM
Michel,

If you review the source code of the FWH debugger in FWH\source\classes\fwdbg.prg you will see
that we use some HB_Dbg_vmVar... functions to retrieve the value of the different vars.

But you have to compile your PRGs using /b

Also in c:\fwteam\source\function\errsysw.prg we use the functions GetParam() and GetLocal() based on:
Code (fw): Select all Collapse
//----------------------------------------------------------------//

function LocalCount( nProcLevel )

return HB_DBG_VMSTKLCOUNT( nProcLevel + 1 ) - ParamCount( nProcLevel + 1 )

//----------------------------------------------------------------------------//

function ParamCount( nProcLevel )

return Len( HB_DBG_VMPARLLIST( nProcLevel + 1 ) )

//----------------------------------------------------------------------------//

function GetParam( nProcLevel, nParam )

return HB_DBG_VMPARLLIST( nProcLevel + 1 )[ nParam ]

//----------------------------------------------------------------------------//
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Re: List of existing variables used
Posted: Thu Jul 09, 2015 10:26 PM

Antonio,

Thanks a lot for your answer.

Regards,

Michel D.
Genk (Belgium)


_____________________________________________________________________________________________

I use : FiveWin for (x)Harbour v. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: List of existing variables used
Posted: Fri Jul 10, 2015 02:22 PM

There is an old program called SNAP that will do this. It also does reformatting and cross-referencing of functions. It won't run on 64bit computers so you will have to use it on a 32bit one. You can get it here:

http://www.the-oasis.net/ftpmaster.php3 ... putils.htm

IMHO, you should get rid of privates and publics. If you really need publics you can always encapsulate them in a function or put them in an INI.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Re: List of existing variables used
Posted: Fri Jul 10, 2015 03:58 PM

Thanks for you tip, James.

I didn't know the Oasis of Phill Barnett (I think) still exists.

Regards,

Michel D.
Genk (Belgium)


_____________________________________________________________________________________________

I use : FiveWin for (x)Harbour v. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: List of existing variables used
Posted: Fri Jul 10, 2015 08:49 PM

Michel,

Yes the Oasis is still there and you can still find some useful things there too.

You can do a lot by just turning on warnings and compiling your code. Then initializing all the LOCALs until the warnings go away.

PRIVATEs used to cause me all kinds of grief until I just stopped using them. They are the hardest bugs to find. I think it is best to just get rid of them. I haven't used them in more than 10 years, maybe more than 15 or 20. Stamp them out.

And you can store all PUBLICs in a static var in a function. The var is a class which contains all the vars you need. So, for instance, you could get the path to the data from anywhere in the program something like this:

app():dataPath

And the font face:

app():fontFace

Easy. No PUBLICs.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10

Continue the discussion