Omnimaga

Calculator Community => TI Calculators => ASM => Topic started by: Xeda112358 on February 28, 2011, 11:53:46 pm

Title: APQ (Another Parser Question)
Post by: Xeda112358 on February 28, 2011, 11:53:46 pm
(Yes, the subject title was stolen from Hot_Dog... Hi Hot_Dog!)
I was wondering if there was a way that I could parse the inputs of a command manually using a parser hook. One reason I want to do this is because I want to modify the dim( command to accept archived variables and strings without throwing an error.

Any help would be much appreciated!
Title: Re: APQ (Another Parser Question)
Post by: thepenguin77 on March 01, 2011, 04:40:36 pm
Yep, that shouldn't be too hard. WikiTi (http://wikiti.brandonw.net/index.php?title=83Plus:Hooks:9BAC) will obviously help if you haven't checked it. What I would do is make a null parser hook (i.e. just returns with proper flags), and then breakpoint it in wabbitemu. Then make a basic program that looks like this, dim(L1:dim(L1:5->dim(L1:5->dim(L1. Run the basic program and figure out how the parser handles dim(. It is either going to be a type 1, 2, or 3 type command, or a combo of 2 and 3. After you have the type, figure out what value of BC it passes to the hook. From here you can write your real parser hook which pops the list off the floating point stack and does it's thing.
Title: Re: APQ (Another Parser Question)
Post by: Xeda112358 on March 01, 2011, 04:46:22 pm
Okay, well it is for BatLib so I do know the type and the value of BC already. I did check WikiTI, too. The thing is, all of the arguments are parsed by the time my parser hook gets to have control and use the arguments. I will see what I can do with the debugger, though...
Title: Re: APQ (Another Parser Question)
Post by: thepenguin77 on March 01, 2011, 04:58:27 pm
Oh, I see. If you want to get hold of the arguments preparsed, then you need to use the mode 0, and go parse them yourself.

Using those three variables mentioned on the wikiTi page, you can find the information in ram, do what you want with it, and then let the parser go. What I did for some of my parser hooks was to completely relocate the tokens somewhere else. But I think since I didn't put the pointers back to their proper locations, I broke all basic programs. :D
Title: Re: APQ (Another Parser Question)
Post by: Xeda112358 on March 01, 2011, 05:02:15 pm
Okay, thanks ♥ I am debugging right now, too, so that I can see exactly what is going on :)

EDIT: Trying to find the pointer to the arguments...
EDIT 2: Found it :D I was working from the homescreen instead of a program...