X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?p=rmac;a=blobdiff_plain;f=expr.c;h=23f6a14afcbb0c46561c101b6d0e43e382acbb56;hp=6e0bd18b4360f92e587deef291dcb707bc1672e5;hb=bb94015a443a0aebaa93ee62f9f2738fa3a96784;hpb=d16b8ea0ee65b2ad901ca6b0624c07e6e4930cc4 diff --git a/expr.c b/expr.c index 6e0bd18..23f6a14 100644 --- a/expr.c +++ b/expr.c @@ -60,7 +60,7 @@ static VALUE str_value(char * p) { VALUE v; - for(v=0; *p; ++p) + for(v=0; *p; p++) v = (v << 8) | (*p & 0xFF); return v; @@ -76,7 +76,7 @@ void init_expr(void) char * p; // Token pointer // Initialize token-class table - for(i=0; i<128; ++i) // Mark all entries END + for(i=0; i<128; i++) // Mark all entries END tokcl[i] = END; for(i=0, p=itokcl; *p!=1; p++) @@ -162,16 +162,7 @@ int expr1(void) #else p = string[*tok++]; #endif - -#if 0 - if (lookup(p, MACRO, 0) == NULL) - w = 0; - else - w = 1; -#else w = (lookup(p, MACRO, 0) == NULL ? 0 : 1); -#endif - *tk++ = CONST; *tk++ = (TOKEN)w; break; @@ -194,15 +185,7 @@ getsym: if (*p == '.') j = curenv; -#if 0 - if ((sy = lookup(p, LABEL, j)) != NULL && (sy->sattr & w)) - w = 1; - else - w = 0; -#else w = ((sy = lookup(p, LABEL, j)) != NULL && (sy->sattr & w) ? 1 : 0); -#endif - *tk++ = CONST; *tk++ = (TOKEN)w; break; @@ -345,12 +328,17 @@ int expr2(void) // int expr(TOKEN * otk, VALUE * a_value, WORD * a_attr, SYM ** a_esym) { + // Passed in values (once derefenced, that is) can all be zero. They are + // there so that the expression analyzer can fill them in as needed. The + // expression analyzer gets its input from "tok", and not from anything + // passed in by the user. SYM * sy; char * p; int j; - tk = otk; // Set token pointer to 'exprbuf' (direct.c) -// symbolNum = 0; // Set symbol number in symbolPtr[] to 0 + tk = otk; // Set token pointer to 'exprbuf' (direct.c) + // Also set in various other places too (risca.c, e.g.) +// symbolNum = 0; // Set symbol number in symbolPtr[] to 0 // Optimize for single constant or single symbol. if ((tok[1] == EOL)