Can I get info about SUB inside SUB?
#6
(05-08-2023, 07:18 PM)SMcNeill Wrote: Wouldn't the easiest way just be to assign a global variable for debug tracing?

Code: (Select All)
DIM SHARED ProgFlow$

SUB Foo
   ProgFlow$ = "Foo Start"
   .... sub stuff
   ProgFlow$ = "Foo Clean Exit"
END SUB

Go further and write a QB64 program that creates a copy of QB64 source code that does this. It wouldn't be very difficult, easier because QB64PE (yet) doesn't support nested subprogram definitions. Only detect "SUB" or "FUNCTION" header and place a line right after it. Then set a flag indicating the processor is inside a subprogram, so it doesn't get confused with "main module" level code. Then when "END SUB" or "END FUNCTION is encountered put a line before that saying the subprogram is about to exit. Also have to check "EXIT SUB" and "EXIT FUNCTION" for it.

With "FUNCTION" get even fancier and even report what type it returns. "Entered function ''Zeroes'' which returns STRING."

It takes more effort to use such an utility, that's why some people expected the IDE to be able to do it.
Reply


Messages In This Thread
RE: Can I get info about SUB inside SUB? - by mnrvovrfc - 05-08-2023, 08:12 PM



Users browsing this thread: 8 Guest(s)