|
Post by Stefan on Sept 10, 2022 6:26:19 GMT -5
Hi George,
I wonder if you might consider a (hopefully) trivial enhancement to SPF_TRACE().
As it stands, SPF_TRACE reports the function being executed, it's return code, plus the message raised (if any). It would be more useful if the trace also included the "RESULT" returned by the function. I appreciate that in some cases the result is the same as the RC, but often it is not, and it is the result which influences the path taken through the macro. If a function returns nothing, the value would be []
For example, a trace might look like this:
12:01:34 Get_RC() RC=0 CHARS 'SUB xorNX(' found 12:01:34 Get_Find_LPtr() RC=0 12:01:34 Get_Next_LPtr(387, 1, DATA) RC=0 12:01:34 Get_XStatus$(389) RC=0
I'm suggesting something like this:
12:01:34 Get_RC() RC=0 CHARS 'SUB xorNX(' found [0] 12:01:34 Get_Find_LPtr() RC=0 [387] 12:01:34 Get_Next_LPtr(387, 1, DATA) RC=0 [389] 12:01:34 Get_XStatus$(389) RC=0 [NX]
The colours are only for illustration here.
|
|
|
Post by George on Sept 11, 2022 12:55:46 GMT -5
Sounds good, only wrinkle is getting the trace code to displsy string/numeric correctly.
|
|
|
Post by Stefan on Sept 13, 2022 11:48:32 GMT -5
Hmm, I'm possibly being simple here, but...
DIM AS NUMBER tenOverThree = 10 / 3 SPF_DEBUG("One third of ten = "+tenOverThree)
executes & displays just fine. Why would TRACE be different, unless thinBasic auto-converts and PowerBasic doesn't?
|
|
|
Post by Stefan on Sept 13, 2022 12:30:37 GMT -5
Makes sense. But I'm still a bit confused. SPF_TRACE only traces SPF-style function calls. And the variable type of the "result" value we seek to show in the trace is a known entity thanks to George's meticulous naming convention for macro functions. Functions whose name ends in $ return strings, those that don't return numeric results.
Not to worry - as you say George is well up to the task.
|
|
|
Post by George on Sept 13, 2022 13:59:27 GMT -5
The problem is that thinBasic is more forgiving. PB isn't. And trace code is executed in PB. George
|
|
|
Post by George on Sept 17, 2022 9:17:13 GMT -5
No, the trace is just plain pb code.
|
|
|
Post by George on Sept 25, 2022 11:04:11 GMT -5
Robert: Yes, famous last words. It's going to mean going through each macro and tweaking it. A pain since in many of them here's a FUNCTION = xxxxxx to set the result (where xxxx may be an internal function call). And you can't pass FUNCTION as a parameter to the TRACE code (Haven't tried it, but pretty sure it will fail).
We'll see.
George
|
|
|
Post by George on Sept 26, 2022 13:21:34 GMT -5
This is now complete. Painful because of the quantity, not the complexity.
George
|
|