PlanetSquires Forums

Support Forums => General Board => Topic started by: Grant McIntosh on December 15, 2012, 03:01:54 PM

Title: Function list
Post by: Grant McIntosh on December 15, 2012, 03:01:54 PM
Hi,
Some time ago I stumbled upon a program (or perhaps a selection in PB or FF) that would list 'what Functions/Subs were being called where', in your source code (eg. Function ABC calls Function XYZ and Function UVW) or whatever.
I had a feeling I stumbled upon it on this site somewhere, but I could be wrong. I've searched my PC, PB, other forums and can't find it, so I'm hoping somebody here might be able to point me in the right direction.  I hope my vague description is enough, I just can't recall the details.

Thanks  :)


Title: Re: Function list
Post by: Carl Oligny on December 15, 2012, 05:47:31 PM
You may be thinking of the trace function. Trace New filename,Trace On , Trace Off , Trace Close - in that order.
Title: Re: Function list
Post by: Grant McIntosh on December 16, 2012, 05:19:29 AM
Thanks Carl, You've reminded me to keep the Trace function in mind and that will be helpful (zTrace I've used before too), though I don't think that's what I was thinking of. Unfortunately it was a while back and I've forgotten many of the details, but recall thinking it would handy.  I had a feeling this was a little more along the lines of PBCodec (which I've found very useful), where it wouldn't just list the trace path, but actually list what subs/functions called what subs/functions, called what... and so on. Sort of like a 'picture' of what could occur, rather than what did occur (as in a trace).

It occurred to me that it might be useful when looking at somebody else's code, where you were trying to understand the possible program flow - or for that matter your own code when you have to come back to it years later and although it's well commented, you are trying to get a picture in your head of how it all works.

Title: Re: Function list
Post by: Jim Dunn on December 16, 2012, 01:43:27 PM
Don't forget you need #TOOLS ON for the TRACE commands to work:

#COMPILE EXE

#TOOLS ON ' <=== REQUIRED for TRACE

FUNCTION PBMAIN () AS LONG

    TRACE NEW "Trace.txt"
    TRACE ON
    TRACE PRINT "Before"
    ? "Test"
    TRACE PRINT "After"
    TRACE PRINT "TRACE PRINT printed this user data from " + FUNCNAME$ + "()"
    TRACE OFF
    TRACE CLOSE

END FUNCTION
Title: Re: Function list
Post by: Grant McIntosh on December 20, 2012, 10:58:58 AM
Thanks Jim, I had a look in the PB Help and got a bit more familiar with it and with your details here, should be helpful :)  Still haven't found the thing I was originally after though. Still, with this and perhaps Ztrace (which I'm still trying to get the latest Ver), I can run through the prog with a trace on and essentially build up a similar picture, so quite handy. PB Codec has been really helpful too, spotted a number of my mistakes! http://www.planetsquires.com/protect/forum/Smileys/default/embarrassed.gif
Thanks again guys.