List of existing variables used

List of existing variables used

Postby driessen » 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. 24.02 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc77
User avatar
driessen
 
Posts: 1396
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: List of existing variables used

Postby Antonio Linares » Thu Jul 09, 2015 2: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: Select all  Expand view
//----------------------------------------------------------------//

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
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: List of existing variables used

Postby driessen » 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. 24.02 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc77
User avatar
driessen
 
Posts: 1396
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: List of existing variables used

Postby James Bott » Fri Jul 10, 2015 2: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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: List of existing variables used

Postby driessen » Fri Jul 10, 2015 3: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. 24.02 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc77
User avatar
driessen
 
Posts: 1396
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: List of existing variables used

Postby James Bott » Fri Jul 10, 2015 8: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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 93 guests