X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?p=rmac;a=blobdiff_plain;f=macro.c;h=5aaa842a52d78d75c4808d676b384a54d5e1d914;hp=5c590e405e51086f762e0c5c45d397b8409004be;hb=d0c28c349ddfb8393568037f68bddbe8979ce0df;hpb=11a78647f7f170e6ea39dd04a3734a359151debb diff --git a/macro.c b/macro.c index 5c590e4..5aaa842 100644 --- a/macro.c +++ b/macro.c @@ -3,7 +3,7 @@ // MACRO.C - Macro Definition and Invocation // Copyright (C) 199x Landon Dyer, 2011 Reboot and Friends // RMAC derived from MADMAC v1.07 Written by Landon Dyer, 1986 -// Source Utilised with the Kind Permission of Landon Dyer +// Source utilised with the kind permission of Landon Dyer // #include "macro.h" @@ -34,7 +34,7 @@ static int rptlevel; // .rept nesting level // -// Initialize Macro Processor +// Initialize macro processor // void InitMacro(void) { @@ -46,7 +46,7 @@ void InitMacro(void) // -// Exit from a Macro; +// Exit from a macro; // -- pop any intervening include files and repeat blocks; // -- restore argument stack; // -- pop the macro. @@ -86,7 +86,7 @@ of another (nested macros). Need to fix that somehow. // -// Add a Formal Argument to a Macro Definition +// Add a formal argument to a macro definition // int defmac2(char * argname) { @@ -333,7 +333,7 @@ int lncatch(int (* lnfunc)(), char * dirlist) for(;;) { - if (tokln() == TKEOF) + if (TokenizeLine() == TKEOF) { errors("encountered end-of-file looking for '%s'", dirlist); fatal("cannot continue"); @@ -350,19 +350,11 @@ int lncatch(int (* lnfunc)(), char * dirlist) if ((tok[2] == ':' || tok[2] == DCOLON)) { if (tok[3] == SYMBOL) // label: symbol -#if 0 - p = (char *)tok[4]; -#else p = string[tok[4]]; -#endif } else { -#if 0 - p = (char *)tok[1]; // symbol -#else p = string[tok[1]]; // Symbol -#endif } } @@ -560,12 +552,13 @@ int InvokeMacro(SYM * mac, WORD siz) Shamus: This construct is meant to deal with nested macros, so the simple minded way we deal with them now won't work. :-/ Have to think about how to fix. -What we could do is simply move the argp with each call, and move it back by the -number of arguments in the macro that's ending. That would solve the problem nicely. +What we could do is simply move the argp with each call, and move it back by +the number of arguments in the macro that's ending. That would solve the +problem nicely. [Which we do now. But that uncovered another problem: the token strings are all -stale by the time a nested macro gets to the end. But they're supposed to be symbols, -which means if we put symbol references into the argument token streams, we can -alleviate this problem.] +stale by the time a nested macro gets to the end. But they're supposed to be +symbols, which means if we put symbol references into the argument token +streams, we can alleviate this problem.] */ #if 0 argptr = (TOKEN **)malloc((nargs + 1) * sizeof(LONG));