Re: goto
- Posted by Kat <gertie at PELL.NET> Jul 16, 2001
- 441 views
On 16 Jul 2001, at 17:34, jbrown105 at hotpop.com wrote: > > Anyone have an idea of how to make a preprocessor to process gotos? Well, for Eu, you have one big constraint as a preprocessor. The "goto" and the :label will haveto be in the same block,, or be one block of it's own. They will be restricted to the procedure or function they live in, no jumping into a procedure or out of one. No overlapping goto blocks unless you want to do some real fancy coding. So,, with that in mind, locate the "goto" and it's :label, lift them out of where they are, drop them into a procedure of that name, passing all the vars used between the goto and the :label. Then pass them all back if they are changed, and reset them in the place you lifted the goto-:label from. It's actually easier to do this in the source code. The C64 had "goto line number". I added "goto :label", then i added "goto variable", then i was able to place the target label anywhere, including in the middle of lines. Ditto with gosubs. Basically, you see the goto, then search for the :label , unless you've already seen it, then you simply resume execution there. I would like to be able to goto out of any level of loop, to avoid multiple exits. Maybe you could do a case statement first, those will all be isolated forwards jumps, and not overlapping, a easy thing to do with routine_id(). I have like 600 irc server commands that are aching for a case, or a goto variable. Kat