1. request for feature in Phix
- Posted by katsmeow Apr 19, 2017
- 1386 views
I have asked for the following feature to be in OE, to no avail. Praps it can be in Phix?
To know the names of the variables, even in a restricted way, and the values of those vars, as demo'd in a hacked-OE way here:
http://designerthinking.com/images/KNOWVARS.GIF
There are two problems with the way i tricked OE to do this:
1) it is slower than it needs to be.
2) it eats up gobs of ram, because it's storing variable data twice (or more).
that is running OE code and i do use that feature in writing code in other language.
2. Re: request for feature in Phix
- Posted by katsmeow Apr 19, 2017
- 1359 views
I think i have been hammered on enough already, even with no posts here in Euphorum. I sent a zip of the source to Ryan, he's a dev, it's up to him. I withdraw my request already. Stupid me.
3. Re: request for feature in Phix
- Posted by jimcbrown (admin) Apr 19, 2017
- 1379 views
I have asked for the following feature to be in OE, to no avail.
To know the names of the variables, even in a restricted way, and the values of those vars, as demo'd in a hacked-OE way here:
http://designerthinking.com/images/KNOWVARS.GIF
that is running OE code and i do use that feature in writing code in other language.
I can't see the image, but something like this already exists in OE 4.1 - as long as you are doing it interpreted. (There's no support for this in the translator.)
You should be able to include euphoria/debug/debug.e and call something like debug:initialize_debugger(machine_func(M_INIT_DEBUGGER, {})) and then call debug:get_symbol_table() and then search the result for the variables.
This has been mentioned a couple of times already: http://openeuphoria.org/forum/m/127983.wc http://openeuphoria.org/forum/m/118515.wc
[Perhaps] it can be in Phix?
If I had to guess, I'd say probably. IIRC Phix doesn't have IL or bytecode, it goes straight from Euphoria syntax to assembly language - but despite being a compiler, IIRC it can print out an ex.err with variable names and information for runtime errors.
4. Re: request for feature in Phix
- Posted by petelomax Apr 19, 2017
- 1370 views
Well, I shall answer the question anyway.
If you go to https://bitbucket.org/petelomax/phix/src and navigate to builtins/VM/prtnidN.e you can see how to get a (local) copy of the symtab that you can play with.
Also in builtins/VM, pDiagN.e has routines getGvarValue() and getTvarValue() that contain code (somewhat overcomplicated for error trapping reasons) to retrieve values.
You may baulk at the inline assembly, but it is all fairly straightforward stuff, and significantly easier than attempting for example an ebp-relative hll peek().
One trick I should mention is that {}=routine_id("dummy") (assuming dummy does not exist) will ensure the symbol table is populated with string names when interpreting.
Obviously both prtnidN.e and pDiagN.e are designed to work the same when compiled and interpreted.
You may also be interested in http://rosettacode.org/wiki/Nested_function#Phix for some clues to retrieving local values from somewhere earlier in the call stack.
Pete