In my quest for barebones debug capability, I basically recreated the elegant work of this old post for a peek/poke capability. I spent an inordinate amount of time fighting a core dump under Frobtads (my main development engine), only to discover it works just fine under QTads.
Anyone successfully used DynFunc with Frobtads, and if so, was there any magic required? Given @RealNC presence in that initial thread, it feels like I’m on my own here.
FTR, here is my code:
#include <dynfunc.h>
#define v2s(Val) reflectionServices.valToSymbol(##Val)
DefineLiteralAction(Peek)
execAction() {
"DEBUG: <<gLiteral>> = <<v2s(Compiler.eval(gLiteral))>>\n";
}
/* this is a meta-command, so don't consume any time */
actionTime = 0
;
VerbRule(Peek)
('peek' | 'dx') singleLiteral : PeekAction
verbPhrase = 'peek/peeking (into what)'
;
And here is my very odd command line coreDump (note extreme leading spaces, actually wrapping on my screen):
>dx 'me.name'
S
egmentation fault (core dumped)
Less urgently, is there a way to override TADS’ period parsing? Just more friction than I want enclosing TADS properties/methods in quotes on the command line. I want this:
So you’re saying your debug-print function works in QTads but not in FrobTADS? I’ll try to look at that later…
As for the quote marks, my function allows this (no final quote needed)…
>dp"me.location.name
but I believe Adv3Lite’s eval function does not require quotes so maybe you could check out how that was implemented…
I don’t know if it causes an error or not, but I don’t think you need the token-pasting operator in your v2s#define. You should be able to just write valToSymbol(Val).
Ok, I am at a loss to explain WHY, but your solution worked in Frobtads where my original did not! Thanks so much! (Yes, my original worked in QTADS but not Frobtads)
Also, I can’t believe I forgot my good friend StringPreProcessor - I Iet myself get swayed by ‘holistic solutions’!
JJMcC, if your need is monitoring a variable/flag, why not look into my “scroll of knowledge” ? IIRC you have seen a deployed one… IIRC, I have posted somewhere here its source, which seems to me good for both adv3 and adv3Lite (needing only changing the name from adv3Lite format to the adv3 format, I guess)
UPDATE: @RealNC Based on some extensive experimentation I have concluded that it only (and always, at least for my experiments) fails Frobtads and not QTADS when I use Compiler.eval(<somecode>). Compiler.compile(<somecode>)() consistently works in both.
In deference to Frobtads, I will personally depricate the use of Compiler.eval