X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?p=rmac;a=blobdiff_plain;f=macro.c;h=4232f1af60e53d323e20ebb242e0c23c02529f59;hp=6e9fd864af4eb370c0ba8f03b00ee4b774d7becf;hb=c74d8ef6f193cb2be876c920c5cb7f599dd5418a;hpb=b10167d55798ea184f97fafda075255c0852f3b6 diff --git a/macro.c b/macro.c index 6e9fd86..4232f1a 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,14 +46,19 @@ 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. // int ExitMacro(void) { -#warning !!! Bad macro exiting !!! +#ifndef _MSC_VER +#pragma message !!! Bad macro exiting !!! +#else +#pragma WARNING(!!! Bad macro exiting !!!) +#endif + /* This is a problem. Currently, the argument logic just keeps the current arguments and doesn't save anything if a new macro is called in the middle @@ -86,7 +91,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) { @@ -110,8 +115,8 @@ int defmac2(char * argname) // int defmac1(char * ln, int notEndFlag) { - PTR p; - LONG len; +// PTR p; +// LONG len; if (list_flag) { @@ -248,7 +253,11 @@ int defr1(char * ln, int kwno) rptlevel++; default: //MORE stupidity here... -#warning "!!! Casting (char *) as LONG !!!" +#ifndef _MSC_VER +#pragma warning "!!! Casting (char *) as LONG !!!" +#else +#pragma WARNING(!!! Casting (char *) as LONG !!!) +#endif addln: // Allocate length of line + 1('\0') + LONG len = strlen(ln) + 1 + sizeof(LONG); @@ -448,7 +457,7 @@ int InvokeMacro(SYM * mac, WORD siz) TOKEN * dest; int stringNum = 0; int argumentNum = 0; - int i; +// int i; for(dry_run=1; ; dry_run--) { @@ -552,12 +561,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));