Author Topic: APQ (Another Parser Question)  (Read 2440 times)

0 Members and 1 Guest are viewing this topic.

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
APQ (Another Parser Question)
« 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!

Offline thepenguin77

  • z80 Assembly Master
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1594
  • Rating: +823/-5
  • The game in my avatar is bit.ly/p0zPWu
    • View Profile
Re: APQ (Another Parser Question)
« Reply #1 on: March 01, 2011, 04:40:36 pm »
Yep, that shouldn't be too hard. WikiTi 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.
zStart v1.3.013 9-20-2013 
All of my utilities
TI-Connect Help
You can build a statue out of either 1'x1' blocks or 12'x12' blocks. The 1'x1' blocks will take a lot longer, but the final product is worth it.
       -Runer112

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: APQ (Another Parser Question)
« Reply #2 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...

Offline thepenguin77

  • z80 Assembly Master
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1594
  • Rating: +823/-5
  • The game in my avatar is bit.ly/p0zPWu
    • View Profile
Re: APQ (Another Parser Question)
« Reply #3 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
zStart v1.3.013 9-20-2013 
All of my utilities
TI-Connect Help
You can build a statue out of either 1'x1' blocks or 12'x12' blocks. The 1'x1' blocks will take a lot longer, but the final product is worth it.
       -Runer112

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: APQ (Another Parser Question)
« Reply #4 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...