diff options
Diffstat (limited to 'rsc/source/rscpp/cpp5.c')
-rw-r--r-- | rsc/source/rscpp/cpp5.c | 422 |
1 files changed, 211 insertions, 211 deletions
diff --git a/rsc/source/rscpp/cpp5.c b/rsc/source/rscpp/cpp5.c index afe5a2fe7d3c..9b4484fbcc9c 100644 --- a/rsc/source/rscpp/cpp5.c +++ b/rsc/source/rscpp/cpp5.c @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -26,16 +26,16 @@ * ************************************************************************/ -#include <stdio.h> -#include <ctype.h> -#include "cppdef.h" -#include "cpp.h" +#include <stdio.h> +#include <ctype.h> +#include "cppdef.h" +#include "cpp.h" /* * Evaluate an #if expression. */ -static char *opname[] = { /* For debug and error messages */ +static char *opname[] = { /* For debug and error messages */ "end of expression", "val", "id", "+", "-", "*", "/", "%", "<<", ">>", "&", "|", "^", @@ -47,133 +47,133 @@ static char *opname[] = { /* For debug and error messages */ /* * opdope[] has the operator precedence: * Bits - * 7 Unused (so the value is always positive) - * 6-2 Precedence (000x .. 017x) - * 1-0 Binary op. flags: - * 01 The binop flag should be set/cleared when this op is seen. - * 10 The new value of the binop flag. + * 7 Unused (so the value is always positive) + * 6-2 Precedence (000x .. 017x) + * 1-0 Binary op. flags: + * 01 The binop flag should be set/cleared when this op is seen. + * 10 The new value of the binop flag. * Note: Expected, New binop - * constant 0 1 Binop, end, or ) should follow constants - * End of line 1 0 End may not be preceeded by an operator - * binary 1 0 Binary op follows a value, value follows. - * unary 0 0 Unary op doesn't follow a value, value follows - * ( 0 0 Doesn't follow value, value or unop follows - * ) 1 1 Follows value. Op follows. + * constant 0 1 Binop, end, or ) should follow constants + * End of line 1 0 End may not be preceeded by an operator + * binary 1 0 Binary op follows a value, value follows. + * unary 0 0 Unary op doesn't follow a value, value follows + * ( 0 0 Doesn't follow value, value or unop follows + * ) 1 1 Follows value. Op follows. */ -static char opdope[OP_MAX] = { - 0001, /* End of expression */ - 0002, /* Digit */ - 0000, /* Letter (identifier) */ - 0141, 0141, 0151, 0151, 0151, /* ADD, SUB, MUL, DIV, MOD */ - 0131, 0131, 0101, 0071, 0071, /* ASL, ASR, AND, OR, XOR */ - 0111, 0111, 0121, 0121, 0121, 0121, /* EQ, NE, LT, LE, GE, GT */ - 0061, 0051, 0041, 0041, 0031, /* ANA, ORO, QUE, COL, CMA */ +static char opdope[OP_MAX] = { + 0001, /* End of expression */ + 0002, /* Digit */ + 0000, /* Letter (identifier) */ + 0141, 0141, 0151, 0151, 0151, /* ADD, SUB, MUL, DIV, MOD */ + 0131, 0131, 0101, 0071, 0071, /* ASL, ASR, AND, OR, XOR */ + 0111, 0111, 0121, 0121, 0121, 0121, /* EQ, NE, LT, LE, GE, GT */ + 0061, 0051, 0041, 0041, 0031, /* ANA, ORO, QUE, COL, CMA */ /* * Unary op's follow */ - 0160, 0160, 0160, 0160, /* NEG, PLU, COM, NOT */ - 0170, 0013, 0023, /* LPA, RPA, END */ + 0160, 0160, 0160, 0160, /* NEG, PLU, COM, NOT */ + 0170, 0013, 0023, /* LPA, RPA, END */ }; /* * OP_QUE and OP_RPA have alternate precedences: */ -#define OP_RPA_PREC 0013 -#define OP_QUE_PREC 0034 +#define OP_RPA_PREC 0013 +#define OP_QUE_PREC 0034 /* * S_ANDOR and S_QUEST signal "short-circuit" boolean evaluation, so that - * #if FOO != 0 && 10 / FOO ... + * #if FOO != 0 && 10 / FOO ... * doesn't generate an error message. They are stored in optab.skip. */ -#define S_ANDOR 2 -#define S_QUEST 1 +#define S_ANDOR 2 +#define S_QUEST 1 typedef struct optab { - char op; /* Operator */ - char prec; /* Its precedence */ - char skip; /* Short-circuit: TRUE to skip */ + char op; /* Operator */ + char prec; /* Its precedence */ + char skip; /* Short-circuit: TRUE to skip */ } OPTAB; -static int evalue; /* Current value from evallex() */ +static int evalue; /* Current value from evallex() */ -#ifdef nomacargs +#ifdef nomacargs FILE_LOCAL int isbinary(op) -register int op; +register int op; { return (op >= FIRST_BINOP && op <= LAST_BINOP); } FILE_LOCAL int isunary(op) -register int op; +register int op; { return (op >= FIRST_UNOP && op <= LAST_UNOP); } #else -#define isbinary(op) (op >= FIRST_BINOP && op <= LAST_BINOP) -#define isunary(op) (op >= FIRST_UNOP && op <= LAST_UNOP) +#define isbinary(op) (op >= FIRST_BINOP && op <= LAST_BINOP) +#define isunary(op) (op >= FIRST_UNOP && op <= LAST_UNOP) #endif /* * The following definitions are used to specify basic variable sizes. */ -#ifndef S_CHAR -#define S_CHAR (sizeof (char)) +#ifndef S_CHAR +#define S_CHAR (sizeof (char)) #endif -#ifndef S_SINT -#define S_SINT (sizeof (short int)) +#ifndef S_SINT +#define S_SINT (sizeof (short int)) #endif -#ifndef S_INT -#define S_INT (sizeof (int)) +#ifndef S_INT +#define S_INT (sizeof (int)) #endif -#ifndef S_LINT -#define S_LINT (sizeof (long int)) +#ifndef S_LINT +#define S_LINT (sizeof (long int)) #endif -#ifndef S_FLOAT -#define S_FLOAT (sizeof (float)) +#ifndef S_FLOAT +#define S_FLOAT (sizeof (float)) #endif -#ifndef S_DOUBLE -#define S_DOUBLE (sizeof (double)) +#ifndef S_DOUBLE +#define S_DOUBLE (sizeof (double)) #endif -#ifndef S_PCHAR -#define S_PCHAR (sizeof (char *)) +#ifndef S_PCHAR +#define S_PCHAR (sizeof (char *)) #endif -#ifndef S_PSINT -#define S_PSINT (sizeof (short int *)) +#ifndef S_PSINT +#define S_PSINT (sizeof (short int *)) #endif -#ifndef S_PINT -#define S_PINT (sizeof (int *)) +#ifndef S_PINT +#define S_PINT (sizeof (int *)) #endif -#ifndef S_PLINT -#define S_PLINT (sizeof (long int *)) +#ifndef S_PLINT +#define S_PLINT (sizeof (long int *)) #endif -#ifndef S_PFLOAT -#define S_PFLOAT (sizeof (float *)) +#ifndef S_PFLOAT +#define S_PFLOAT (sizeof (float *)) #endif -#ifndef S_PDOUBLE -#define S_PDOUBLE (sizeof (double *)) +#ifndef S_PDOUBLE +#define S_PDOUBLE (sizeof (double *)) #endif -#ifndef S_PFPTR -#define S_PFPTR (sizeof (int (*)())) +#ifndef S_PFPTR +#define S_PFPTR (sizeof (int (*)())) #endif typedef struct types { - short type; /* This is the bit if */ - char *name; /* this is the token word */ + short type; /* This is the bit if */ + char *name; /* this is the token word */ } TYPES; static TYPES basic_types[] = { - { T_CHAR, "char", }, - { T_INT, "int", }, - { T_FLOAT, "float", }, - { T_DOUBLE, "double", }, - { T_SHORT, "short", }, - { T_LONG, "long", }, - { T_SIGNED, "signed", }, - { T_UNSIGNED, "unsigned", }, - { 0, NULL, }, /* Signal end */ + { T_CHAR, "char", }, + { T_INT, "int", }, + { T_FLOAT, "float", }, + { T_DOUBLE, "double", }, + { T_SHORT, "short", }, + { T_LONG, "long", }, + { T_SIGNED, "signed", }, + { T_UNSIGNED, "unsigned", }, + { 0, NULL, }, /* Signal end */ }; /* @@ -184,24 +184,24 @@ static short test_table[] = { T_FLOAT | T_DOUBLE | T_CHAR | T_INT, T_FLOAT | T_DOUBLE | T_SIGNED | T_UNSIGNED, T_LONG | T_SHORT | T_CHAR, - 0 /* end marker */ + 0 /* end marker */ }; /* * The order of this table is important -- it is also referenced by * the command line processor to allow run-time overriding of the * built-in size values. The order must not be changed: - * char, short, int, long, float, double (func pointer) + * char, short, int, long, float, double (func pointer) */ SIZES size_table[] = { - { T_CHAR, S_CHAR, S_PCHAR }, /* char */ - { T_SHORT, S_SINT, S_PSINT }, /* short int */ - { T_INT, S_INT, S_PINT }, /* int */ - { T_LONG, S_LINT, S_PLINT }, /* long */ - { T_FLOAT, S_FLOAT, S_PFLOAT }, /* float */ - { T_DOUBLE, S_DOUBLE, S_PDOUBLE }, /* double */ - { T_FPTR, 0, S_PFPTR }, /* int (*()) */ - { 0, 0, 0 }, /* End of table */ + { T_CHAR, S_CHAR, S_PCHAR }, /* char */ + { T_SHORT, S_SINT, S_PSINT }, /* short int */ + { T_INT, S_INT, S_PINT }, /* int */ + { T_LONG, S_LINT, S_PLINT }, /* long */ + { T_FLOAT, S_FLOAT, S_PFLOAT }, /* float */ + { T_DOUBLE, S_DOUBLE, S_PDOUBLE }, /* double */ + { T_FPTR, 0, S_PFPTR }, /* int (*()) */ + { 0, 0, 0 }, /* End of table */ }; @@ -218,49 +218,49 @@ eval() * Evaluate an expression. Straight-forward operator precedence. * This is called from control() on encountering an #if statement. * It calls the following routines: - * evallex Lexical analyser -- returns the type and value of - * the next input token. - * evaleval Evaluate the current operator, given the values on - * the value stack. Returns a pointer to the (new) - * value stack. + * evallex Lexical analyser -- returns the type and value of + * the next input token. + * evaleval Evaluate the current operator, given the values on + * the value stack. Returns a pointer to the (new) + * value stack. * For compatiblity with older cpp's, this return returns 1 (TRUE) * if a syntax error is detected. */ { - register int op; /* Current operator */ - register int *valp; /* -> value vector */ - register OPTAB *opp; /* Operator stack */ - int prec; /* Op precedence */ - int binop; /* Set if binary op. needed */ - int op1; /* Operand from stack */ - int skip; /* For short-circuit testing */ - int value[NEXP]; /* Value stack */ - OPTAB opstack[NEXP]; /* Operand stack */ + register int op; /* Current operator */ + register int *valp; /* -> value vector */ + register OPTAB *opp; /* Operator stack */ + int prec; /* Op precedence */ + int binop; /* Set if binary op. needed */ + int op1; /* Operand from stack */ + int skip; /* For short-circuit testing */ + int value[NEXP]; /* Value stack */ + OPTAB opstack[NEXP]; /* Operand stack */ #ifndef ZTC /* BP */ extern int *evaleval(); /* Does actual evaluation */ #endif valp = value; opp = opstack; - opp->op = OP_END; /* Mark bottom of stack */ - opp->prec = opdope[OP_END]; /* And its precedence */ - opp->skip = 0; /* Not skipping now */ + opp->op = OP_END; /* Mark bottom of stack */ + opp->prec = opdope[OP_END]; /* And its precedence */ + opp->skip = 0; /* Not skipping now */ binop = 0; -again: ; -#ifdef DEBUG_EVAL +again: ; +#ifdef DEBUG_EVAL fprintf( pCppOut, "In #if at again: skip = %d, binop = %d, line is: %s", opp->skip, binop, infile->bptr); #endif if ((op = evallex(opp->skip)) == OP_SUB && binop == 0) - op = OP_NEG; /* Unary minus */ + op = OP_NEG; /* Unary minus */ else if (op == OP_ADD && binop == 0) - op = OP_PLU; /* Unary plus */ + op = OP_PLU; /* Unary plus */ else if (op == OP_FAIL) - return (1); /* Error in evallex */ -#ifdef DEBUG_EVAL + return (1); /* Error in evallex */ +#ifdef DEBUG_EVAL fprintf( pCppOut, "op = %s, opdope = %03o, binop = %d, skip = %d\n", opname[op], opdope[op], binop, opp->skip); #endif - if (op == DIG) { /* Value? */ + if (op == DIG) { /* Value? */ if (binop != 0) { cerror("misplaced constant in #if", NULLST); return (1); @@ -270,7 +270,7 @@ again: ; return (1); } else { -#ifdef DEBUG_EVAL +#ifdef DEBUG_EVAL fprintf( pCppOut, "pushing %d onto value stack[%d]\n", evalue, valp - value); #endif @@ -290,7 +290,7 @@ again: ; } binop = (prec & 2) >> 1; for (;;) { -#ifdef DEBUG_EVAL +#ifdef DEBUG_EVAL fprintf( pCppOut, "op %s, prec %d., stacked op %s, prec %d, skip %d\n", opname[op], prec, opname[opp->op], opp->prec, opp->skip); #endif @@ -299,7 +299,7 @@ again: ; prec = OP_RPA_PREC; else if (op == OP_QUE) prec = OP_QUE_PREC; - op1 = opp->skip; /* Save skip for test */ + op1 = opp->skip; /* Save skip for test */ /* * Push operator onto op. stack. */ @@ -311,24 +311,24 @@ again: ; } opp->op = (char)op; opp->prec = (char)prec; - skip = (valp[-1] != 0); /* Short-circuit tester */ + skip = (valp[-1] != 0); /* Short-circuit tester */ /* * Do the short-circuit stuff here. Short-circuiting * stops automagically when operators are evaluated. */ if ((op == OP_ANA && !skip) || (op == OP_ORO && skip)) - opp->skip = S_ANDOR; /* And/or skip starts */ - else if (op == OP_QUE) /* Start of ?: operator */ + opp->skip = S_ANDOR; /* And/or skip starts */ + else if (op == OP_QUE) /* Start of ?: operator */ opp->skip = (char)((op1 & S_ANDOR) | ((!skip) ? S_QUEST : 0)); - else if (op == OP_COL) { /* : inverts S_QUEST */ + else if (op == OP_COL) { /* : inverts S_QUEST */ opp->skip = (char)((op1 & S_ANDOR) | (((op1 & S_QUEST) != 0) ? 0 : S_QUEST)); } - else { /* Other ops leave */ - opp->skip = (char)op1; /* skipping unchanged. */ + else { /* Other ops leave */ + opp->skip = (char)op1; /* skipping unchanged. */ } -#ifdef DEBUG_EVAL +#ifdef DEBUG_EVAL fprintf( pCppOut, "stacking %s, valp[-1] == %d at %s", opname[op], valp[-1], infile->bptr); dumpstack(opstack, opp, value, valp); @@ -339,27 +339,27 @@ again: ; * Pop operator from op. stack and evaluate it. * End of stack and '(' are specials. */ - skip = opp->skip; /* Remember skip value */ - switch ((op1 = opp->op)) { /* Look at stacked op */ - case OP_END: /* Stack end marker */ + skip = opp->skip; /* Remember skip value */ + switch ((op1 = opp->op)) { /* Look at stacked op */ + case OP_END: /* Stack end marker */ if (op == OP_EOE) - return (valp[-1]); /* Finished ok. */ - goto again; /* Read another op. */ + return (valp[-1]); /* Finished ok. */ + goto again; /* Read another op. */ - case OP_LPA: /* ( on stack */ - if (op != OP_RPA) { /* Matches ) on input */ + case OP_LPA: /* ( on stack */ + if (op != OP_RPA) { /* Matches ) on input */ cerror("unbalanced paren's, op is \"%s\"", opname[op]); return (1); } - opp--; /* Unstack it */ - /* goto again; -- Fall through */ + opp--; /* Unstack it */ + /* goto again; -- Fall through */ case OP_QUE: - goto again; /* Evaluate true expr. */ + goto again; /* Evaluate true expr. */ - case OP_COL: /* : on stack. */ - opp--; /* Unstack : */ - if (opp->op != OP_QUE) { /* Matches ? on stack? */ + case OP_COL: /* : on stack. */ + opp--; /* Unstack : */ + if (opp->op != OP_QUE) { /* Matches ? on stack? */ cerror("Misplaced '?' or ':', previous operator is %s", opname[(int)opp->op]); return (1); @@ -367,19 +367,19 @@ again: ; /* * Evaluate op1. */ - default: /* Others: */ - opp--; /* Unstack the operator */ -#ifdef DEBUG_EVAL + default: /* Others: */ + opp--; /* Unstack the operator */ +#ifdef DEBUG_EVAL fprintf( pCppOut, "Stack before evaluation of %s\n", opname[op1]); dumpstack(opstack, opp, value, valp); #endif valp = evaleval(valp, op1, skip); -#ifdef DEBUG_EVAL +#ifdef DEBUG_EVAL fprintf( pCppOut, "Stack after evaluation\n"); dumpstack(opstack, opp, value, valp); #endif - } /* op1 switch end */ - } /* Stack unwind loop */ + } /* op1 switch end */ + } /* Stack unwind loop */ } FILE_LOCAL int @@ -388,20 +388,20 @@ evallex(int skip) * Return next eval operator or value. Called from eval(). It * calls a special-purpose routines for 'char' strings and * numeric values: - * evalchar called to evaluate 'x' - * evalnum called to evaluate numbers. + * evalchar called to evaluate 'x' + * evalnum called to evaluate numbers. */ { - register int c, c1, t; + register int c, c1, t; -again: do { /* Collect the token */ +again: do { /* Collect the token */ c = skipws(); if ((c = macroid(c)) == EOF_CHAR || c == '\n') { unget(); - return (OP_EOE); /* End of expression */ + return (OP_EOE); /* End of expression */ } } while ((t = type[c]) == LET && catenate()); - if (t == INV) { /* Total nonsense */ + if (t == INV) { /* Total nonsense */ if (!skip) { if (isascii(c) && isprint(c)) cierror("illegal character '%c' in #if", c); @@ -410,38 +410,38 @@ again: do { /* Collect the token */ } return (OP_FAIL); } - else if (t == QUO) { /* ' or " */ - if (c == '\'') { /* Character constant */ - evalue = evalchar(skip); /* Somewhat messy */ -#ifdef DEBUG_EVAL + else if (t == QUO) { /* ' or " */ + if (c == '\'') { /* Character constant */ + evalue = evalchar(skip); /* Somewhat messy */ +#ifdef DEBUG_EVAL fprintf( pCppOut, "evalchar returns %d.\n", evalue); #endif - return (DIG); /* Return a value */ + return (DIG); /* Return a value */ } cerror("Can't use a string in an #if", NULLST); return (OP_FAIL); } - else if (t == LET) { /* ID must be a macro */ - if (streq(token, "defined")) { /* Or defined name */ + else if (t == LET) { /* ID must be a macro */ + if (streq(token, "defined")) { /* Or defined name */ c1 = c = skipws(); - if (c == '(') /* Allow defined(name) */ + if (c == '(') /* Allow defined(name) */ c = skipws(); if (type[c] == LET) { evalue = (lookid(c) != NULL); - if (c1 != '(' /* Need to balance */ - || skipws() == ')') /* Did we balance? */ - return (DIG); /* Parsed ok */ + if (c1 != '(' /* Need to balance */ + || skipws() == ')') /* Did we balance? */ + return (DIG); /* Parsed ok */ } cerror("Bad #if ... defined() syntax", NULLST); return (OP_FAIL); } - else if (streq(token, "sizeof")) /* New sizeof hackery */ - return (dosizeof()); /* Gets own routine */ + else if (streq(token, "sizeof")) /* New sizeof hackery */ + return (dosizeof()); /* Gets own routine */ /* * The Draft ANSI C Standard says that an undefined symbol * in an #if has the value zero. We are a bit pickier, * warning except where the programmer was careful to write - * #if defined(foo) ? foo : 0 + * #if defined(foo) ? foo : 0 */ #ifdef STRICT_UNDEF if (!skip) @@ -450,9 +450,9 @@ again: do { /* Collect the token */ evalue = 0; return (DIG); } - else if (t == DIG) { /* Numbers are harder */ + else if (t == DIG) { /* Numbers are harder */ evalue = evalnum(c); -#ifdef DEBUG_EVAL +#ifdef DEBUG_EVAL fprintf( pCppOut, "evalnum returns %d.\n", evalue); #endif } @@ -460,7 +460,7 @@ again: do { /* Collect the token */ /* * Process a possible multi-byte lexeme. */ - c1 = cget(); /* Peek at next char */ + c1 = cget(); /* Peek at next char */ switch (c) { case '!': if (c1 == '=') @@ -468,7 +468,7 @@ again: do { /* Collect the token */ break; case '=': - if (c1 != '=') { /* Can't say a=b in #if */ + if (c1 != '=') { /* Can't say a=b in #if */ unget(); cerror("= not allowed in #if", NULLST); return (OP_FAIL); @@ -490,7 +490,7 @@ again: do { /* Collect the token */ break; case '\\': - if (c1 == '\n') /* Multi-line if */ + if (c1 == '\n') /* Multi-line if */ goto again; cerror("Unexpected \\ in #if", NULLST); return (OP_FAIL); @@ -505,15 +505,15 @@ dosizeof() /* * Process the sizeof (basic type) operation in an #if string. * Sets evalue to the size and returns - * DIG success - * OP_FAIL bad parse or something. + * DIG success + * OP_FAIL bad parse or something. */ { - register int c; - register TYPES *tp; - register SIZES *sizp; - register short *testp; - short typecode; + register int c; + register TYPES *tp; + register SIZES *sizp; + register short *testp; + short typecode; if ((c = skipws()) != '(') goto nogood; @@ -523,23 +523,23 @@ dosizeof() typecode = 0; while (0 != (c = skipws())) { if ((c = macroid(c)) == EOF_CHAR || c == '\n') - goto nogood; /* End of line is a bug */ - else if (c == '(') { /* thing (*)() func ptr */ + goto nogood; /* End of line is a bug */ + else if (c == '(') { /* thing (*)() func ptr */ if (skipws() == '*' - && skipws() == ')') { /* We found (*) */ - if (skipws() != '(') /* Let () be optional */ + && skipws() == ')') { /* We found (*) */ + if (skipws() != '(') /* Let () be optional */ unget(); else if (skipws() != ')') goto nogood; - typecode |= T_FPTR; /* Function pointer */ + typecode |= T_FPTR; /* Function pointer */ } - else { /* Junk is a bug */ + else { /* Junk is a bug */ goto nogood; } } - else if (type[c] != LET) /* Exit if not a type */ + else if (type[c] != LET) /* Exit if not a type */ break; - else if (!catenate()) { /* Maybe combine tokens */ + else if (!catenate()) { /* Maybe combine tokens */ /* * Look for this unexpandable token in basic_types. * The code accepts "int long" as well as "long int" @@ -554,7 +554,7 @@ dosizeof() cerror("#if sizeof, unknown type \"%s\"", token); return (OP_FAIL); } - typecode |= tp->type; /* Or in the type bit */ + typecode |= tp->type; /* Or in the type bit */ } } /* @@ -564,7 +564,7 @@ dosizeof() typecode |= T_PTR; c = skipws(); } - if (c == ')') { /* Last syntax check */ + if (c == ')') { /* Last syntax check */ for (testp = test_table; *testp != 0; testp++) { if (!bittest(typecode & *testp)) { cerror("#if ... sizeof: illegal type combination", NULLST); @@ -573,13 +573,13 @@ dosizeof() } /* * We assume that all function pointers are the same size: - * sizeof (int (*)()) == sizeof (float (*)()) + * sizeof (int (*)()) == sizeof (float (*)()) * We assume that signed and unsigned don't change the size: - * sizeof (signed int) == (sizeof unsigned int) + * sizeof (signed int) == (sizeof unsigned int) */ - if ((typecode & T_FPTR) != 0) /* Function pointer */ + if ((typecode & T_FPTR) != 0) /* Function pointer */ typecode = T_FPTR | T_PTR; - else { /* Var or var * datum */ + else { /* Var or var * datum */ typecode &= ~(T_SIGNED | T_UNSIGNED); if ((typecode & (T_SHORT | T_LONG)) != 0) typecode &= ~T_INT; @@ -597,12 +597,12 @@ dosizeof() ? sizp->psize : sizp->size; return (DIG); } - } /* We shouldn't fail */ + } /* We shouldn't fail */ cierror("#if ... sizeof: bug, unknown type code 0x%x", typecode); return (OP_FAIL); } -nogood: unget(); +nogood: unget(); cerror("#if ... sizeof() syntax error", NULLST); return (OP_FAIL); } @@ -630,9 +630,9 @@ evalnum(int c) * the unsigned suffix, but only returns a signed int value. */ { - register int value; - register int base; - register int c1; + register int value; + register int base; + register int c1; if (c != '0') base = 10; @@ -647,7 +647,7 @@ evalnum(int c) if (isascii(c) && isupper(c1)) c1 = tolower(c1); #ifdef EBCDIC - if (c1 <= 'f') + if (c1 <= 'f') #else if (c1 >= 'a') #endif @@ -659,7 +659,7 @@ evalnum(int c) value += c1; c = cget(); } - if (c == 'u' || c == 'U') /* Unsigned nonsense */ + if (c == 'u' || c == 'U') /* Unsigned nonsense */ c = cget(); unget(); return (value); @@ -671,18 +671,18 @@ evalchar(int skip) * Get a character constant */ { - register int c; - register int value; - register int count; + register int c; + register int value; + register int count; instring = TRUE; if ((c = cget()) == '\\') { switch ((c = cget())) { - case 'a': /* New in Standard */ + case 'a': /* New in Standard */ #if ('a' == '\a' || '\a' == ALERT) - value = ALERT; /* Use predefined value */ + value = ALERT; /* Use predefined value */ #else - value = '\a'; /* Use compiler's value */ + value = '\a'; /* Use compiler's value */ #endif break; @@ -706,15 +706,15 @@ evalchar(int skip) value = '\t'; break; - case 'v': /* New in Standard */ + case 'v': /* New in Standard */ #if ('v' == '\v' || '\v' == VT) - value = VT; /* Use predefined value */ + value = VT; /* Use predefined value */ #else - value = '\v'; /* Use compiler's value */ + value = '\v'; /* Use compiler's value */ #endif break; - case 'x': /* '\xFF' */ + case 'x': /* '\xFF' */ count = 3; value = 0; while ((((c = get()) >= '0' && c <= '9') @@ -783,12 +783,12 @@ evaleval(int* valp, int op, int skip) * evaleval() returns the new pointer to the top of the value stack. */ { - register int v1, v2 = 0; + register int v1, v2 = 0; if (isbinary(op)) v2 = *--valp; v1 = *--valp; -#ifdef DEBUG_EVAL +#ifdef DEBUG_EVAL fprintf( pCppOut, "%s op %s", (isbinary(op)) ? "binary" : "unary", opname[op]); if (isbinary(op)) @@ -909,12 +909,12 @@ evaleval(int* valp, int op, int skip) return (valp); } -#ifdef DEBUG_EVAL +#ifdef DEBUG_EVAL dumpstack(opstack, opp, value, valp) -OPTAB opstack[NEXP]; /* Operand stack */ -register OPTAB *opp; /* Operator stack */ -int value[NEXP]; /* Value stack */ -register int *valp; /* -> value vector */ +OPTAB opstack[NEXP]; /* Operand stack */ +register OPTAB *opp; /* Operator stack */ +int value[NEXP]; /* Value stack */ +register int *valp; /* -> value vector */ { fprintf( pCppOut, "index op prec skip name -- op stack at %s", infile->bptr); while (opp > opstack) { |