// N.B.: The size of tokenClass should be identical to the largest value of
// a token; we're assuming 256 but not 100% sure!
static char tokenClass[256]; // Generated table of token classes
// N.B.: The size of tokenClass should be identical to the largest value of
// a token; we're assuming 256 but not 100% sure!
static char tokenClass[256]; // Generated table of token classes
p = string[*tok++];
w = (lookup(p, MACRO, 0) == NULL ? 0 : 1);
*evalTokenBuffer++ = CONST;
p = string[*tok++];
w = (lookup(p, MACRO, 0) == NULL ? 0 : 1);
*evalTokenBuffer++ = CONST;
j = (*p == '.' ? curenv : 0);
w = ((sy = lookup(p, LABEL, j)) != NULL && (sy->sattr & w) ? 1 : 0);
*evalTokenBuffer++ = CONST;
j = (*p == '.' ? curenv : 0);
w = ((sy = lookup(p, LABEL, j)) != NULL && (sy->sattr & w) ? 1 : 0);
*evalTokenBuffer++ = CONST;
w = (WORD)(!strcmp(p, p2));
*evalTokenBuffer++ = CONST;
w = (WORD)(!strcmp(p, p2));
*evalTokenBuffer++ = CONST;
-int expr(TOKEN * otk, VALUE * a_value, WORD * a_attr, SYM ** a_esym)
+int expr(TOKEN * otk, uint64_t * 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
{
// 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
//printf("expr(): tokens 0-2: %i %i %i (%c %c %c); tc[2] = %i\n", tok[0], tok[1], tok[2], tok[0], tok[1], tok[2], tokenClass[tok[2]]);
// Optimize for single constant or single symbol.
//printf("expr(): tokens 0-2: %i %i %i (%c %c %c); tc[2] = %i\n", tok[0], tok[1], tok[2], tok[0], tok[1], tok[2], tokenClass[tok[2]]);
// Optimize for single constant or single symbol.
// Seems that even other tokens (SUNARY type) can fuck this up too.
// if ((tok[1] == EOL)
if ((tok[1] == EOL && (tok[0] != CONST && tokenClass[tok[0]] != SUNARY))
// Seems that even other tokens (SUNARY type) can fuck this up too.
// if ((tok[1] == EOL)
if ((tok[1] == EOL && (tok[0] != CONST && tokenClass[tok[0]] != SUNARY))
- || (((*tok == CONST || *tok == SYMBOL) || (*tok >= KW_R0 && *tok <= KW_R31))
- && (tokenClass[tok[2]] < UNARY)))
+// || (((*tok == CONST || *tok == SYMBOL) || (*tok >= KW_R0 && *tok <= KW_R31))
+// && (tokenClass[tok[2]] < UNARY)))
+ || (((tok[0] == SYMBOL) || (tok[0] >= KW_R0 && tok[0] <= KW_R31))
+ && (tokenClass[tok[2]] < UNARY))
+ || ((tok[0] == CONST) && (tokenClass[tok[3]] < UNARY))
+ )
//printf("Quick eval in expr(): CONST = %i, tokenClass[tok[2]] = %i\n", *a_value, tokenClass[*tok]);
}
else if (*tok == '*')
{
*evalTokenBuffer++ = CONST;
//printf("Quick eval in expr(): CONST = %i, tokenClass[tok[2]] = %i\n", *a_value, tokenClass[*tok]);
}
else if (*tok == '*')
{
*evalTokenBuffer++ = CONST;
// UNDEFINED, but it's value includes everything but the symbol value, and
// `a_esym' is set to the external symbol.
//
// UNDEFINED, but it's value includes everything but the symbol value, and
// `a_esym' is set to the external symbol.
//
-int evexpr(TOKEN * tk, VALUE * a_value, WORD * a_attr, SYM ** a_esym)
+int evexpr(TOKEN * tk, uint64_t * a_value, WORD * a_attr, SYM ** a_esym)
-//printf("evexpr(): CONST = %i\n", *tk);
- *++sval = *tk++; // Push value
+ *++sval = ((uint64_t)*tk++) << 32; // Push value
+ *sval |= *tk++; // & LO LONG (will this work???--should)
+//printf("evexpr(): CONST = %lX\n", *sval);
// Compiler is picky here: Without casting these, it discards
// the sign if dividing a negative # by a positive one,
// creating a bad result. :-/
// Compiler is picky here: Without casting these, it discards
// the sign if dividing a negative # by a positive one,
// creating a bad result. :-/
- // Probably a side effect of using VALUE intead of ints.
- *sval = (int)sval[0] / (int)sval[1];
+ // Definitely a side effect of using uint32_ts intead of ints.
+ *sval = (int32_t)sval[0] / (int32_t)sval[1];