version 1.7, 2015/08/14 13:51:56 |
version 1.8, 2018/03/29 01:32:54 |
|
|
* DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, |
* DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, |
* PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. |
* PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. |
* |
* |
* $OpenXM: OpenXM_contrib2/asir2000/parse/cpp.c,v 1.6 2015/08/08 14:19:42 fujimoto Exp $ |
* $OpenXM: OpenXM_contrib2/asir2000/parse/cpp.c,v 1.7 2015/08/14 13:51:56 fujimoto Exp $ |
*/ |
*/ |
#include <stdio.h> |
#include <stdio.h> |
#include <ctype.h> |
#include <ctype.h> |
Line 328 void read_formals(void) |
|
Line 328 void read_formals(void) |
|
nargs ++; |
nargs ++; |
c = getnonspace(); |
c = getnonspace(); |
if (c == ')') |
if (c == ')') |
{ return; |
{ return; |
} |
} |
else if (c != ',') |
else if (c != ',') |
{ err_head(); |
{ err_head(); |
fprintf(stderr,"invalid macro parameter delimiter\n"); |
fprintf(stderr,"invalid macro parameter delimiter\n"); |
} |
} |
} |
} |
else |
else |
{ c = Get(); |
{ c = Get(); |
if ((c == ')') && (nargs == 0)) |
if ((c == ')') && (nargs == 0)) |
{ return; |
{ return; |
} |
} |
else |
else |
{ Push(c); |
{ Push(c); |
} |
} |
err_head(); |
err_head(); |
fprintf(stderr,"missing/illegal macro parameter\n"); |
fprintf(stderr,"missing/illegal macro parameter\n"); |
while (1) |
while (1) |
{ c = Get(); |
{ c = Get(); |
if (c == ')') |
if (c == ')') |
{ return; |
{ return; |
} |
|
if (isbsymchar(c)) |
|
{ Push(c); |
|
break; |
|
} |
|
} |
|
} |
} |
|
if (isbsymchar(c)) |
|
{ Push(c); |
|
break; |
|
} |
} |
} |
|
} |
|
} |
} |
} |
|
|
void do_define(int sharp, int redef) |
void do_define(int sharp, int redef) |
Line 376 void do_define(int sharp, int redef) |
|
Line 376 void do_define(int sharp, int redef) |
|
{ char e = '\0'; |
{ char e = '\0'; |
if (sharp) |
if (sharp) |
{ while (1) |
{ while (1) |
{ c = e; |
{ c = e; |
e = Get(); |
e = Get(); |
if (e == '\n') |
if (e == '\n') |
{ if (c == '\\') |
{ if (c == '\\') |
{ maybe_print('\n'); |
{ maybe_print('\n'); |
} |
} |
else |
else |
{ break; |
{ break; |
} |
} |
} |
|
} |
|
} |
} |
|
} |
|
} |
else |
else |
{ do |
{ do |
{ c = e; |
{ c = e; |
e = Get(); |
e = Get(); |
} while ((c != '@') || (e == '@')); |
} while ((c != '@') || (e == '@')); |
Push(e); |
Push(e); |
} |
} |
return; |
return; |
Line 429 void do_define(int sharp, int redef) |
|
Line 429 void do_define(int sharp, int redef) |
|
{ while (1) |
{ while (1) |
{ c = Get(); |
{ c = Get(); |
if (quoted && (c == '\n')) |
if (quoted && (c == '\n')) |
{ quoted = 0; |
{ quoted = 0; |
maybe_print('\n'); |
maybe_print('\n'); |
} |
} |
else if (quoted) |
else if (quoted) |
{ accum_char(acc,'\\'); |
{ accum_char(acc,'\\'); |
accum_char(acc,c); |
accum_char(acc,c); |
quoted = 0; |
quoted = 0; |
} |
} |
else if (c == '/') |
else if (c == '/') |
{ char d = Get(); |
{ char d = Get(); |
accum_char(acc,'/'); |
accum_char(acc,'/'); |
if (d == '*') |
if (d == '*') |
{ accum_char(acc,'*'); |
{ accum_char(acc,'*'); |
incomment = 1; |
incomment = 1; |
} |
} |
else |
else |
{ Push(d); |
{ Push(d); |
} |
} |
} |
} |
else if (incomment) |
else if (incomment) |
{ accum_char(acc,c); |
{ accum_char(acc,c); |
if (c == '*') |
if (c == '*') |
{ char d = Get(); |
{ char d = Get(); |
if (d == '/') |
if (d == '/') |
{ accum_char(acc,'/'); |
{ accum_char(acc,'/'); |
incomment = 0; |
incomment = 0; |
} |
} |
else |
else |
{ Push(d); |
{ Push(d); |
} |
} |
} |
} |
else if (c == '\n') |
else if (c == '\n') |
{ maybe_print('\n'); |
{ maybe_print('\n'); |
} |
} |
} |
} |
else if (c == '\\') |
else if (c == '\\') |
{ quoted = 1; |
{ quoted = 1; |
} |
} |
else if (c == '\n') |
else if (c == '\n') |
{ break; |
{ break; |
} |
} |
else |
else |
{ accum_char(acc,c); |
{ accum_char(acc,c); |
} |
} |
} |
} |
} |
} |
else |
else |
{ while (1) |
{ while (1) |
{ c = Get(); |
{ c = Get(); |
if (quoted && (c == '@')) |
if (quoted && (c == '@')) |
{ accum_char(acc,'@'); |
{ accum_char(acc,'@'); |
quoted = 0; |
quoted = 0; |
} |
} |
else if (quoted) |
else if (quoted) |
{ Push(c); |
{ Push(c); |
break; |
break; |
} |
} |
else if (c == '/') |
else if (c == '/') |
{ char d = Get(); |
{ char d = Get(); |
accum_char(acc,'/'); |
accum_char(acc,'/'); |
if (d == '*') |
if (d == '*') |
{ accum_char(acc,'*'); |
{ accum_char(acc,'*'); |
incomment = 1; |
incomment = 1; |
} |
} |
else |
else |
{ Push(d); |
{ Push(d); |
} |
} |
} |
} |
else if (incomment) |
else if (incomment) |
{ accum_char(acc,c); |
{ accum_char(acc,c); |
if (c == '*') |
if (c == '*') |
{ char d = Get(); |
{ char d = Get(); |
if (d == '/') |
if (d == '/') |
{ accum_char(acc,'/'); |
{ accum_char(acc,'/'); |
incomment = 0; |
incomment = 0; |
} |
} |
else |
else |
{ Push(d); |
{ Push(d); |
} |
} |
} |
} |
else if (c == '\n') |
else if (c == '\n') |
{ maybe_print('\n'); |
{ maybe_print('\n'); |
} |
} |
} |
} |
else if (c == '@') |
else if (c == '@') |
{ quoted = 1; |
{ quoted = 1; |
} |
} |
else |
else |
{ if (c == '\n') |
{ if (c == '\n') |
{ maybe_print('\n'); |
{ maybe_print('\n'); |
} |
|
accum_char(acc,c); |
|
} |
|
} |
} |
|
accum_char(acc,c); |
} |
} |
|
} |
|
} |
repl = (unsigned char *) accum_result(acc); |
repl = (unsigned char *) accum_result(acc); |
f = repl; |
f = repl; |
t = repl; |
t = repl; |
Line 533 void do_define(int sharp, int redef) |
|
Line 533 void do_define(int sharp, int redef) |
|
c = *g; |
c = *g; |
*g = '\0'; |
*g = '\0'; |
for (i=0;i<nargs;i++) |
for (i=0;i<nargs;i++) |
{ if (strcmp((char *)f,argnames[i]) == 0) |
{ if (strcmp((char *)f,argnames[i]) == 0) |
{ break; |
{ break; |
} |
} |
} |
} |
if (i < nargs) |
if (i < nargs) |
{ *t++ = 0x80 | i; |
{ *t++ = 0x80 | i; |
f = g; |
f = g; |
} |
} |
else |
else |
{ while (*t++ = *f++) ; |
{ while (*t++ = *f++) ; |
f --; |
f --; |
t --; |
t --; |
} |
} |
*g = c; |
*g = c; |
} |
} |
else if ((f[0] == '/') && (f[1] == '*')) |
else if ((f[0] == '/') && (f[1] == '*')) |
Line 590 void do_dump(void) |
|
Line 590 void do_dump(void) |
|
extern int fstackdepth; |
extern int fstackdepth; |
|
|
fprintf(stderr, |
fprintf(stderr, |
"\n\n\tDump of definition table (%d entries in %d buckets):\n\n", |
"\n\n\tDump of definition table (%d entries in %d buckets):\n\n", |
n_in_table,symtbl_size); |
n_in_table,symtbl_size); |
for (i=0;i<symtbl_size;i++) |
for (i=0;i<symtbl_size;i++) |
{ fprintf(stderr,"Bucket %d:\n",i); |
{ fprintf(stderr,"Bucket %d:\n",i); |
for (d=symtbl[i];d;d=d->link) |
for (d=symtbl[i];d;d=d->link) |
Line 733 void read_actuals(DEF *d) |
|
Line 733 void read_actuals(DEF *d) |
|
c = Get(); |
c = Get(); |
accum_char(acc,c); |
accum_char(acc,c); |
if (comment) |
if (comment) |
{ if ((last == '*') && (c == '/')) |
{ if ((last == '*') && (c == '/')) |
{ comment = 0; |
{ comment = 0; |
} |
} |
} |
} |
else |
else |
{ if (backslash) |
{ if (backslash) |
{ backslash = 0; |
{ backslash = 0; |
} |
|
else if (quote && (c == quote)) |
|
{ quote = 0; |
|
} |
|
else if (c == '\\') |
|
{ backslash = 1; |
|
} |
|
else if (quote) |
|
{ |
|
} |
|
else if ((last == '/') && (c == '*')) |
|
{ comment = 1; |
|
} |
|
else if ((c == '\'') || (c == '"')) |
|
{ quote = c; |
|
} |
|
else if (c == '(') |
|
{ pc ++; |
|
} |
|
else if (c == ')') |
|
{ if (pc > 0) |
|
{ pc --; |
|
} |
|
else |
|
{ accum_regret(acc); |
|
break; |
|
} |
|
} |
|
else if ((c == ',') && (pc == 0)) |
|
{ accum_regret(acc); |
|
break; |
|
} |
|
} |
|
} |
} |
|
else if (quote && (c == quote)) |
|
{ quote = 0; |
|
} |
|
else if (c == '\\') |
|
{ backslash = 1; |
|
} |
|
else if (quote) |
|
{ |
|
} |
|
else if ((last == '/') && (c == '*')) |
|
{ comment = 1; |
|
} |
|
else if ((c == '\'') || (c == '"')) |
|
{ quote = c; |
|
} |
|
else if (c == '(') |
|
{ pc ++; |
|
} |
|
else if (c == ')') |
|
{ if (pc > 0) |
|
{ pc --; |
|
} |
|
else |
|
{ accum_regret(acc); |
|
break; |
|
} |
|
} |
|
else if ((c == ',') && (pc == 0)) |
|
{ accum_regret(acc); |
|
break; |
|
} |
|
} |
|
} |
if (i < n) |
if (i < n) |
{ actuals[i] = accum_result(acc); |
{ actuals[i] = accum_result(acc); |
actlens[i] = strlen(actuals[i]); |
actlens[i] = strlen(actuals[i]); |
Line 823 void expand_def(DEF *d) |
|
Line 823 void expand_def(DEF *d) |
|
else if (d->nargs > 0) |
else if (d->nargs > 0) |
{ int i; |
{ int i; |
for (i=0;i<d->nargs;i++) |
for (i=0;i<d->nargs;i++) |
{ outputc((char)(i?',':'(')); |
{ outputc((char)(i?',':'(')); |
outputs(actuals[i]); |
outputs(actuals[i]); |
} |
} |
outputc(')'); |
outputc(')'); |
} |
} |
outputs("-->"); |
outputs("-->"); |
Line 842 void expand_def(DEF *d) |
|
Line 842 void expand_def(DEF *d) |
|
int i; |
int i; |
i = *cp & ~0x80; |
i = *cp & ~0x80; |
for (dp=actuals[i];*dp;dp++) |
for (dp=actuals[i];*dp;dp++) |
{ accum_char(result,*dp); |
{ accum_char(result,*dp); |
} |
} |
} |
} |
else |
else |
{ accum_char(result,*cp); |
{ accum_char(result,*cp); |
Line 867 void expand_def(DEF *d) |
|
Line 867 void expand_def(DEF *d) |
|
{ if (!incomm && (last == '/') && (*ep == '*')) |
{ if (!incomm && (last == '/') && (*ep == '*')) |
{ incomm = 1; |
{ incomm = 1; |
if (!keep_comments || (strncmp(ep,"**/",3) == 0)) |
if (!keep_comments || (strncmp(ep,"**/",3) == 0)) |
{ accum_regret(result); |
{ accum_regret(result); |
ok = 0; |
ok = 0; |
} |
} |
} |
} |
if (ok) |
if (ok) |
{ accum_char(result,*ep); |
{ accum_char(result,*ep); |
Line 914 void expand_def(DEF *d) |
|
Line 914 void expand_def(DEF *d) |
|
#define AND TWOCHAR('&','&') |
#define AND TWOCHAR('&','&') |
#define OR TWOCHAR('|','|') |
#define OR TWOCHAR('|','|') |
|
|
#define ALLBINS \ |
#define ALLBINS \ |
BIN('*',*) \ |
BIN('*',*) \ |
BIN('/',/) \ |
BIN('/',/) \ |
BIN('%',%) \ |
BIN('%',%) \ |
BIN('+',+) \ |
BIN('+',+) \ |
BIN(LSH,<<) \ |
BIN(LSH,<<) \ |
BIN(RSH,>>) \ |
BIN(RSH,>>) \ |
BIN('<',<) \ |
BIN('<',<) \ |
BIN('>',>) \ |
BIN('>',>) \ |
BIN(LEQ,<=) \ |
BIN(LEQ,<=) \ |
BIN(GEQ,>=) \ |
BIN(GEQ,>=) \ |
BIN(EQL,==) \ |
BIN(EQL,==) \ |
BIN(NEQ,!=) \ |
BIN(NEQ,!=) \ |
BIN('&',&) \ |
BIN('&',&) \ |
BIN('^',^) \ |
BIN('^',^) \ |
BIN('|',|) \ |
BIN('|',|) \ |
BIN(AND,&&) \ |
BIN(AND,&&) \ |
BIN(OR ,||) |
BIN(OR ,||) |
|
|
char *Index(char *s, int c); |
char *Index(char *s, int c); |
|
|
Line 951 void free_expr(NODE *n) |
|
Line 951 void free_expr(NODE *n) |
|
break; |
break; |
case '-': |
case '-': |
if (n->left) |
if (n->left) |
{ free_expr(n->left); |
{ free_expr(n->left); |
} |
} |
free_expr(n->right); |
free_expr(n->right); |
break; |
break; |
case '!': |
case '!': |
Line 982 int exec_free(NODE *n) |
|
Line 982 int exec_free(NODE *n) |
|
break; |
break; |
case '-': |
case '-': |
if (n->left) |
if (n->left) |
{ rv = exec_free(n->left); |
{ rv = exec_free(n->left); |
} |
} |
else |
else |
{ rv = 0; |
{ rv = 0; |
} |
} |
rv -= exec_free(n->right); |
rv -= exec_free(n->right); |
break; |
break; |
case '!': |
case '!': |
Line 1017 int exec_nofree(NODE *n) |
|
Line 1017 int exec_nofree(NODE *n) |
|
break; |
break; |
case '-': |
case '-': |
if (n->left) |
if (n->left) |
{ rv = exec_nofree(n->left); |
{ rv = exec_nofree(n->left); |
} |
} |
else |
else |
{ rv = 0; |
{ rv = 0; |
} |
} |
rv -= exec_nofree(n->right); |
rv -= exec_nofree(n->right); |
break; |
break; |
case '!': |
case '!': |
Line 1103 int get_quote_char(void) |
|
Line 1103 int get_quote_char(void) |
|
{ d = (d << 3) + c - '0'; |
{ d = (d << 3) + c - '0'; |
c = Get(); |
c = Get(); |
if ((c >= '0') && (c <= '7')) |
if ((c >= '0') && (c <= '7')) |
{ d = (d << 3) + c - '0'; |
{ d = (d << 3) + c - '0'; |
} |
} |
else |
else |
{ Push(c); |
{ Push(c); |
} |
} |
} |
} |
else |
else |
{ Push(c); |
{ Push(c); |
Line 1158 NODE *read_expr_11(void) |
|
Line 1158 NODE *read_expr_11(void) |
|
NODE *read_expr_(void); |
NODE *read_expr_(void); |
#ifdef DEBUG_EXPR |
#ifdef DEBUG_EXPR |
if (debugging) |
if (debugging) |
{ outputs("()"); |
{ outputs("()"); |
} |
} |
#endif |
#endif |
n = read_expr_(); |
n = read_expr_(); |
c = getnhsexpand(); |
c = getnhsexpand(); |
if (c != ')') |
if (c != ')') |
{ err_head(); |
{ err_head(); |
fprintf(stderr,"expression syntax error -- missing ) supplied\n"); |
fprintf(stderr,"expression syntax error -- missing ) supplied\n"); |
Push(c); |
Push(c); |
} |
} |
#ifdef DEBUG_EXPR |
#ifdef DEBUG_EXPR |
if (debugging) |
if (debugging) |
{ outputs("~"); |
{ outputs("~"); |
} |
} |
#endif |
#endif |
return(n); |
return(n); |
} |
} |
Line 1179 NODE *read_expr_11(void) |
|
Line 1179 NODE *read_expr_11(void) |
|
{ int base; |
{ int base; |
static char digits[] = "0123456789abcdefABCDEF"; |
static char digits[] = "0123456789abcdefABCDEF"; |
static char values[] = |
static char values[] = |
"\0\1\2\3\4\5\6\7\10\11\12\13\14\15\16\17\12\13\14\15\16\17"; |
"\0\1\2\3\4\5\6\7\10\11\12\13\14\15\16\17\12\13\14\15\16\17"; |
char *d; |
char *d; |
int v; |
int v; |
#ifdef DEBUG_EXPR |
#ifdef DEBUG_EXPR |
if (debugging) |
if (debugging) |
{ outputs("N"); |
{ outputs("N"); |
} |
} |
#endif |
#endif |
base = 10; |
base = 10; |
if (c == '0') |
if (c == '0') |
{ base = 8; |
{ base = 8; |
c = Get(); |
c = Get(); |
if ((c == 'x') || (c == 'X')) |
if ((c == 'x') || (c == 'X')) |
{ base = 16; |
{ base = 16; |
c = Get(); |
c = Get(); |
} |
} |
} |
} |
v = 0; |
v = 0; |
while (1) |
while (1) |
{ d = Index(digits,c); |
{ d = Index(digits,c); |
if (d == 0) |
if (d == 0) |
{ Push(c); |
{ Push(c); |
#ifdef DEBUG_EXPR |
#ifdef DEBUG_EXPR |
if (debugging) |
if (debugging) |
{ outputd(v); |
{ outputd(v); |
outputs("~"); |
outputs("~"); |
} |
} |
#endif |
#endif |
return(newleaf(v)); |
return(newleaf(v)); |
} |
|
else if (values[d-digits] >= base) |
|
{ err_head(); |
|
fprintf(stderr,"warning: illegal %sdigit `%c'\n", |
|
(base==16)?"hex ":(base==8)?"octal ":"",c); |
|
} |
|
v = (v * base) + values[d-digits]; |
|
c = Get(); |
|
} |
|
} |
} |
|
else if (values[d-digits] >= base) |
|
{ err_head(); |
|
fprintf(stderr,"warning: illegal %sdigit `%c'\n", |
|
(base==16)?"hex ":(base==8)?"octal ":"",c); |
|
} |
|
v = (v * base) + values[d-digits]; |
|
c = Get(); |
|
} |
|
} |
else if (c == '\'') |
else if (c == '\'') |
{ int i; |
{ int i; |
int j; |
int j; |
Line 1225 NODE *read_expr_11(void) |
|
Line 1225 NODE *read_expr_11(void) |
|
i = 0; |
i = 0; |
n = 0; |
n = 0; |
while (1) |
while (1) |
{ j = get_quote_char(); |
{ j = get_quote_char(); |
if (j < 0) |
if (j < 0) |
{ break; |
{ break; |
} |
} |
i = (i << 8) | j; |
i = (i << 8) | j; |
n ++; |
n ++; |
} |
} |
if (n > 4) |
if (n > 4) |
{ err_head(); |
{ err_head(); |
fprintf(stderr,"warning: too many characters in character constant\n"); |
fprintf(stderr,"warning: too many characters in character constant\n"); |
} |
} |
return(newleaf(i)); |
return(newleaf(i)); |
} |
} |
else if ((c == '\n') && !sharp) |
else if ((c == '\n') && !sharp) |
Line 1244 NODE *read_expr_11(void) |
|
Line 1244 NODE *read_expr_11(void) |
|
else |
else |
{ char *id; |
{ char *id; |
if (complain) |
if (complain) |
{ err_head(); |
{ err_head(); |
fprintf(stderr,"expression syntax error -- number expected\n"); |
fprintf(stderr,"expression syntax error -- number expected\n"); |
} |
} |
if (isbsymchar(c)) |
if (isbsymchar(c)) |
{ Push(c); |
{ Push(c); |
id = read_ident(); |
id = read_ident(); |
} |
} |
else |
else |
{ id = 0; |
{ id = 0; |
} |
} |
#ifdef DEBUG_EXPR |
#ifdef DEBUG_EXPR |
if (debugging) |
if (debugging) |
{ outputs("0("); |
{ outputs("0("); |
outputc(c); |
outputc(c); |
outputs(":"); |
outputs(":"); |
outputs(id?id:"(none)"); |
outputs(id?id:"(none)"); |
outputs(")~"); |
outputs(")~"); |
} |
} |
#endif |
#endif |
if (id) |
if (id) |
{ free(id); |
{ free(id); |
} |
} |
return(newleaf(0)); |
return(newleaf(0)); |
} |
} |
} |
} |
Line 1289 NODE *read_expr_10(void) |
|
Line 1289 NODE *read_expr_10(void) |
|
case '~': |
case '~': |
case '!': |
case '!': |
#ifdef DEBUG_EXPR |
#ifdef DEBUG_EXPR |
if (debugging) |
if (debugging) |
{ outputc(c); |
{ outputc(c); |
} |
} |
#endif |
#endif |
n = read_expr_10(); |
n = read_expr_10(); |
#ifdef DEBUG_EXPR |
#ifdef DEBUG_EXPR |
if (debugging) |
if (debugging) |
{ outputs("~"); |
{ outputs("~"); |
} |
} |
#endif |
#endif |
return(newnode(0,c,n)); |
return(newnode(0,c,n)); |
break; |
break; |
case 'd': |
case 'd': |
Push(c); |
Push(c); |
input_mark(); |
input_mark(); |
w = read_ident(); |
w = read_ident(); |
if (strcmp(w,"defined") == 0) |
if (strcmp(w,"defined") == 0) |
{ c = getnonspace(); |
{ c = getnonspace(); |
if (c == '(') |
if (c == '(') |
{ char *id; |
{ char *id; |
id = read_ident(); |
id = read_ident(); |
if (id) |
if (id) |
{ c = getnonspace(); |
{ c = getnonspace(); |
if (c == ')') |
if (c == ')') |
{ input_unmark(); |
{ input_unmark(); |
#ifdef DEBUG_EXPR |
#ifdef DEBUG_EXPR |
if (debugging) |
if (debugging) |
{ outputs("ifdef"); |
{ outputs("ifdef"); |
} |
} |
#endif |
#endif |
return(newname(id)); |
return(newname(id)); |
} |
} |
} |
} |
} |
} |
else if (isbsymchar(c)) |
else if (isbsymchar(c)) |
{ char *id; |
{ char *id; |
Push(c); |
Push(c); |
id = read_ident(); |
id = read_ident(); |
if (id) |
if (id) |
{ input_unmark(); |
{ input_unmark(); |
#ifdef DEBUG_EXPR |
#ifdef DEBUG_EXPR |
if (debugging) |
if (debugging) |
{ outputs("ifdef"); |
{ outputs("ifdef"); |
} |
} |
#endif |
#endif |
return(newname(id)); |
return(newname(id)); |
} |
} |
} |
} |
} |
} |
input_recover(); |
input_recover(); |
n = read_expr_11(); |
n = read_expr_11(); |
#ifdef DEBUG_EXPR |
#ifdef DEBUG_EXPR |
if (debugging) |
if (debugging) |
{ outputs("~"); |
{ outputs("~"); |
} |
} |
#endif |
#endif |
return(n); |
return(n); |
break; |
break; |
default: |
default: |
Push(c); |
Push(c); |
n = read_expr_11(); |
n = read_expr_11(); |
#ifdef DEBUG_EXPR |
#ifdef DEBUG_EXPR |
if (debugging) |
if (debugging) |
{ outputs("~"); |
{ outputs("~"); |
} |
} |
#endif |
#endif |
return(n); |
return(n); |
break; |
break; |
} |
} |
} |
} |
} |
} |
Line 1380 NODE *read_expr_9(void) |
|
Line 1380 NODE *read_expr_9(void) |
|
case '/': |
case '/': |
case '%': |
case '%': |
#ifdef DEBUG_EXPR |
#ifdef DEBUG_EXPR |
if (debugging) |
if (debugging) |
{ outputc(c); |
{ outputc(c); |
} |
} |
#endif |
#endif |
r = read_expr_10(); |
r = read_expr_10(); |
l = newnode(l,c,r); |
l = newnode(l,c,r); |
break; |
break; |
default: |
default: |
#ifdef DEBUG_EXPR |
#ifdef DEBUG_EXPR |
if (debugging) |
if (debugging) |
{ outputs("~"); |
{ outputs("~"); |
} |
} |
#endif |
#endif |
Push(c); |
Push(c); |
return(l); |
return(l); |
break; |
break; |
} |
} |
} |
} |
} |
} |
Line 1418 NODE *read_expr_8(void) |
|
Line 1418 NODE *read_expr_8(void) |
|
{ case '+': |
{ case '+': |
case '-': |
case '-': |
#ifdef DEBUG_EXPR |
#ifdef DEBUG_EXPR |
if (debugging) |
if (debugging) |
{ outputc(c); |
{ outputc(c); |
} |
} |
#endif |
#endif |
r = read_expr_9(); |
r = read_expr_9(); |
l = newnode(l,c,r); |
l = newnode(l,c,r); |
break; |
break; |
default: |
default: |
#ifdef DEBUG_EXPR |
#ifdef DEBUG_EXPR |
if (debugging) |
if (debugging) |
{ outputs("~"); |
{ outputs("~"); |
} |
} |
#endif |
#endif |
Push(c); |
Push(c); |
return(l); |
return(l); |
break; |
break; |
} |
} |
} |
} |
} |
} |
Line 1456 NODE *read_expr_7(void) |
|
Line 1456 NODE *read_expr_7(void) |
|
switch (c) |
switch (c) |
{ case '<': |
{ case '<': |
case '>': |
case '>': |
d = Get(); |
d = Get(); |
if (d == c) |
if (d == c) |
{ |
{ |
#ifdef DEBUG_EXPR |
#ifdef DEBUG_EXPR |
if (debugging) |
if (debugging) |
{ outputc(c); |
{ outputc(c); |
outputc(d); |
outputc(d); |
} |
} |
#endif |
#endif |
r = read_expr_8(); |
r = read_expr_8(); |
l = newnode(l,(c=='<')?LSH:RSH,r); |
l = newnode(l,(c=='<')?LSH:RSH,r); |
break; |
break; |
} |
} |
Push(d); |
Push(d); |
/* fall through ... */ |
/* fall through ... */ |
default: |
default: |
#ifdef DEBUG_EXPR |
#ifdef DEBUG_EXPR |
if (debugging) |
if (debugging) |
{ outputs("~"); |
{ outputs("~"); |
} |
} |
#endif |
#endif |
Push(c); |
Push(c); |
return(l); |
return(l); |
break; |
break; |
} |
} |
} |
} |
} |
} |
Line 1502 NODE *read_expr_6(void) |
|
Line 1502 NODE *read_expr_6(void) |
|
switch (c) |
switch (c) |
{ case '<': |
{ case '<': |
case '>': |
case '>': |
d = Get(); |
d = Get(); |
if (d == '=') |
if (d == '=') |
{ |
{ |
#ifdef DEBUG_EXPR |
#ifdef DEBUG_EXPR |
if (debugging) |
if (debugging) |
{ outputc(c); |
{ outputc(c); |
outputc(d); |
outputc(d); |
} |
} |
#endif |
#endif |
r = read_expr_7(); |
r = read_expr_7(); |
l = newnode(l,(c=='<')?LEQ:GEQ,r); |
l = newnode(l,(c=='<')?LEQ:GEQ,r); |
} |
} |
else |
else |
{ |
{ |
#ifdef DEBUG_EXPR |
#ifdef DEBUG_EXPR |
if (debugging) |
if (debugging) |
{ outputc(c); |
{ outputc(c); |
} |
} |
#endif |
#endif |
Push(d); |
Push(d); |
r = read_expr_7(); |
r = read_expr_7(); |
l = newnode(l,c,r); |
l = newnode(l,c,r); |
} |
} |
break; |
break; |
default: |
default: |
#ifdef DEBUG_EXPR |
#ifdef DEBUG_EXPR |
if (debugging) |
if (debugging) |
{ outputs("~"); |
{ outputs("~"); |
} |
} |
#endif |
#endif |
Push(c); |
Push(c); |
return(l); |
return(l); |
break; |
break; |
} |
} |
} |
} |
} |
} |
Line 1557 NODE *read_expr_5(void) |
|
Line 1557 NODE *read_expr_5(void) |
|
switch (c) |
switch (c) |
{ case '=': |
{ case '=': |
case '!': |
case '!': |
d = Get(); |
d = Get(); |
if (d == '=') |
if (d == '=') |
{ |
{ |
#ifdef DEBUG_EXPR |
#ifdef DEBUG_EXPR |
if (debugging) |
if (debugging) |
{ outputc(c); |
{ outputc(c); |
outputc(d); |
outputc(d); |
} |
} |
#endif |
#endif |
r = read_expr_6(); |
r = read_expr_6(); |
l = newnode(l,(c=='=')?EQL:NEQ,r); |
l = newnode(l,(c=='=')?EQL:NEQ,r); |
break; |
break; |
} |
} |
Push(d); |
Push(d); |
/* fall through ... */ |
/* fall through ... */ |
default: |
default: |
#ifdef DEBUG_EXPR |
#ifdef DEBUG_EXPR |
if (debugging) |
if (debugging) |
{ outputs("~"); |
{ outputs("~"); |
} |
} |
#endif |
#endif |
Push(c); |
Push(c); |
return(l); |
return(l); |
break; |
break; |
} |
} |
} |
} |
} |
} |
Line 1602 NODE *read_expr_4(void) |
|
Line 1602 NODE *read_expr_4(void) |
|
{ c = getnhsexpand(); |
{ c = getnhsexpand(); |
switch (c) |
switch (c) |
{ case '&': |
{ case '&': |
d = Get(); |
d = Get(); |
if (d != '&') |
if (d != '&') |
{ |
{ |
#ifdef DEBUG_EXPR |
#ifdef DEBUG_EXPR |
if (debugging) |
if (debugging) |
{ outputc(c); |
{ outputc(c); |
outputc(d); |
outputc(d); |
} |
} |
#endif |
#endif |
r = read_expr_5(); |
r = read_expr_5(); |
l = newnode(l,c,r); |
l = newnode(l,c,r); |
break; |
break; |
} |
} |
Push(d); |
Push(d); |
/* fall through ... */ |
/* fall through ... */ |
default: |
default: |
#ifdef DEBUG_EXPR |
#ifdef DEBUG_EXPR |
if (debugging) |
if (debugging) |
{ outputs("~"); |
{ outputs("~"); |
} |
} |
#endif |
#endif |
Push(c); |
Push(c); |
return(l); |
return(l); |
break; |
break; |
} |
} |
} |
} |
} |
} |
Line 1647 NODE *read_expr_3(void) |
|
Line 1647 NODE *read_expr_3(void) |
|
switch (c) |
switch (c) |
{ case '^': |
{ case '^': |
#ifdef DEBUG_EXPR |
#ifdef DEBUG_EXPR |
if (debugging) |
if (debugging) |
{ outputc(c); |
{ outputc(c); |
} |
} |
#endif |
#endif |
r = read_expr_4(); |
r = read_expr_4(); |
l = newnode(l,c,r); |
l = newnode(l,c,r); |
break; |
break; |
default: |
default: |
#ifdef DEBUG_EXPR |
#ifdef DEBUG_EXPR |
if (debugging) |
if (debugging) |
{ outputs("~"); |
{ outputs("~"); |
} |
} |
#endif |
#endif |
Push(c); |
Push(c); |
return(l); |
return(l); |
break; |
break; |
} |
} |
} |
} |
} |
} |
Line 1684 NODE *read_expr_2(void) |
|
Line 1684 NODE *read_expr_2(void) |
|
{ c = getnhsexpand(); |
{ c = getnhsexpand(); |
switch (c) |
switch (c) |
{ case '|': |
{ case '|': |
d = Get(); |
d = Get(); |
if (d != '|') |
if (d != '|') |
{ Push(d); |
{ Push(d); |
#ifdef DEBUG_EXPR |
#ifdef DEBUG_EXPR |
if (debugging) |
if (debugging) |
{ outputc(c); |
{ outputc(c); |
} |
} |
#endif |
#endif |
r = read_expr_3(); |
r = read_expr_3(); |
l = newnode(l,c,r); |
l = newnode(l,c,r); |
break; |
break; |
} |
} |
Push(d); |
Push(d); |
/* fall through ... */ |
/* fall through ... */ |
default: |
default: |
#ifdef DEBUG_EXPR |
#ifdef DEBUG_EXPR |
if (debugging) |
if (debugging) |
{ outputs("~"); |
{ outputs("~"); |
} |
} |
#endif |
#endif |
Push(c); |
Push(c); |
return(l); |
return(l); |
break; |
break; |
} |
} |
} |
} |
} |
} |
Line 1728 NODE *read_expr_1(void) |
|
Line 1728 NODE *read_expr_1(void) |
|
{ c = getnhsexpand(); |
{ c = getnhsexpand(); |
switch (c) |
switch (c) |
{ case '&': |
{ case '&': |
d = Get(); |
d = Get(); |
if (d == c) |
if (d == c) |
{ |
{ |
#ifdef DEBUG_EXPR |
#ifdef DEBUG_EXPR |
if (debugging) |
if (debugging) |
{ outputc(c); |
{ outputc(c); |
outputc(d); |
outputc(d); |
} |
} |
#endif |
#endif |
r = read_expr_2(); |
r = read_expr_2(); |
l = newnode(l,AND,r); |
l = newnode(l,AND,r); |
break; |
break; |
} |
} |
Push(d); |
Push(d); |
/* fall through ... */ |
/* fall through ... */ |
default: |
default: |
#ifdef DEBUG_EXPR |
#ifdef DEBUG_EXPR |
if (debugging) |
if (debugging) |
{ outputs("~"); |
{ outputs("~"); |
} |
} |
#endif |
#endif |
Push(c); |
Push(c); |
return(l); |
return(l); |
break; |
break; |
} |
} |
} |
} |
} |
} |
Line 1773 NODE *read_expr_0(void) |
|
Line 1773 NODE *read_expr_0(void) |
|
{ c = getnhsexpand(); |
{ c = getnhsexpand(); |
switch (c) |
switch (c) |
{ case '|': |
{ case '|': |
d = Get(); |
d = Get(); |
if (d == c) |
if (d == c) |
{ |
{ |
#ifdef DEBUG_EXPR |
#ifdef DEBUG_EXPR |
if (debugging) |
if (debugging) |
{ outputc(c); |
{ outputc(c); |
outputc(d); |
outputc(d); |
} |
} |
#endif |
#endif |
r = read_expr_1(); |
r = read_expr_1(); |
l = newnode(l,OR,r); |
l = newnode(l,OR,r); |
break; |
break; |
} |
} |
Push(d); |
Push(d); |
/* fall through ... */ |
/* fall through ... */ |
default: |
default: |
#ifdef DEBUG_EXPR |
#ifdef DEBUG_EXPR |
if (debugging) |
if (debugging) |
{ outputs("~"); |
{ outputs("~"); |
} |
} |
#endif |
#endif |
Push(c); |
Push(c); |
return(l); |
return(l); |
break; |
break; |
} |
} |
} |
} |
} |
} |
Line 1818 NODE *read_expr_(void) |
|
Line 1818 NODE *read_expr_(void) |
|
switch (c) |
switch (c) |
{ case '\n': |
{ case '\n': |
case ')': |
case ')': |
Push(c); |
Push(c); |
return(l); |
return(l); |
break; |
break; |
case ',': |
case ',': |
r = read_expr_0(); |
r = read_expr_0(); |
l = newnode(l,c,r); |
l = newnode(l,c,r); |
break; |
break; |
default: |
default: |
err_head(); |
err_head(); |
fprintf(stderr,"expression syntax error -- bad operator `%c'\n",c); |
fprintf(stderr,"expression syntax error -- bad operator `%c'\n",c); |
return(l); |
return(l); |
break; |
break; |
} |
} |
} |
} |
} |
} |
Line 1906 void dump_expr(NODE *n) |
|
Line 1906 void dump_expr(NODE *n) |
|
break; |
break; |
case '-': |
case '-': |
if (n->left) |
if (n->left) |
{ dump_expr(n->left); |
{ dump_expr(n->left); |
} |
} |
outputc('-'); |
outputc('-'); |
dump_expr(n->right); |
dump_expr(n->right); |
break; |
break; |
Line 1925 void dump_expr(NODE *n) |
|
Line 1925 void dump_expr(NODE *n) |
|
outputc(')'); |
outputc(')'); |
break; |
break; |
#define BIN(key,op) case key:dump_expr(n->left);\ |
#define BIN(key,op) case key:dump_expr(n->left);\ |
putx(key);\ |
putx(key);\ |
dump_expr(n->right);\ |
dump_expr(n->right);\ |
break; |
break; |
ALLBINS |
ALLBINS |
#undef BIN |
#undef BIN |
} |
} |
Line 1970 void do_if(int expr_sharp) |
|
Line 1970 void do_if(int expr_sharp) |
|
if (sharp) |
if (sharp) |
{ d = '\0'; |
{ d = '\0'; |
do |
do |
{ c = d; |
{ c = d; |
d = Get(); |
d = Get(); |
} while ((c == '\\') || (d != '\n')); |
} while ((c == '\\') || (d != '\n')); |
} |
} |
return; |
return; |
} |
} |
Line 1985 void do_if(int expr_sharp) |
|
Line 1985 void do_if(int expr_sharp) |
|
iffalse(); |
iffalse(); |
#ifdef DEBUG_IF |
#ifdef DEBUG_IF |
if (debugging) |
if (debugging) |
{ outputc('>'); |
{ outputc('>'); |
fflush(outfile); |
fflush(outfile); |
} |
} |
#endif |
#endif |
return; |
return; |
} |
} |
Line 2033 void do_ifdef(int expr_sharp) |
|
Line 2033 void do_ifdef(int expr_sharp) |
|
{ |
{ |
#ifdef DEBUG_IF |
#ifdef DEBUG_IF |
if (debugging) |
if (debugging) |
{ outputs("no ident "); |
{ outputs("no ident "); |
fflush(outfile); |
fflush(outfile); |
} |
} |
#endif |
#endif |
iffalse(); |
iffalse(); |
} |
} |
Line 2043 void do_ifdef(int expr_sharp) |
|
Line 2043 void do_ifdef(int expr_sharp) |
|
{ |
{ |
#ifdef DEBUG_IF |
#ifdef DEBUG_IF |
if (debugging) |
if (debugging) |
{ outputs(w); |
{ outputs(w); |
outputc(' '); |
outputc(' '); |
fflush(outfile); |
fflush(outfile); |
} |
} |
#endif |
#endif |
if (find_def(w)) |
if (find_def(w)) |
{ iftrue(); |
{ iftrue(); |
} |
} |
else |
else |
{ iffalse(); |
{ iffalse(); |
} |
} |
free(w); |
free(w); |
} |
} |
#ifdef DEBUG_IF |
#ifdef DEBUG_IF |
Line 2095 void do_ifndef(int expr_sharp) |
|
Line 2095 void do_ifndef(int expr_sharp) |
|
{ |
{ |
#ifdef DEBUG_IF |
#ifdef DEBUG_IF |
if (debugging) |
if (debugging) |
{ outputs("no ident "); |
{ outputs("no ident "); |
fflush(outfile); |
fflush(outfile); |
} |
} |
#endif |
#endif |
iftrue(); |
iftrue(); |
} |
} |
Line 2105 void do_ifndef(int expr_sharp) |
|
Line 2105 void do_ifndef(int expr_sharp) |
|
{ |
{ |
#ifdef DEBUG_IF |
#ifdef DEBUG_IF |
if (debugging) |
if (debugging) |
{ outputs(w); |
{ outputs(w); |
outputc(' '); |
outputc(' '); |
fflush(outfile); |
fflush(outfile); |
} |
} |
#endif |
#endif |
if (find_def(w)) |
if (find_def(w)) |
{ iffalse(); |
{ iffalse(); |
} |
} |
else |
else |
{ iftrue(); |
{ iftrue(); |
} |
} |
free(w); |
free(w); |
} |
} |
#ifdef DEBUG_IF |
#ifdef DEBUG_IF |
Line 2145 void do_else(int expr_sharp) |
|
Line 2145 void do_else(int expr_sharp) |
|
{ |
{ |
#ifdef DEBUG_IF |
#ifdef DEBUG_IF |
if (debugging) |
if (debugging) |
{ outputs("top "); |
{ outputs("top "); |
output_ifstate(ifstack->condstate); |
output_ifstate(ifstack->condstate); |
fflush(outfile); |
fflush(outfile); |
} |
} |
#endif |
#endif |
switch (ifstack->condstate) |
switch (ifstack->condstate) |
{ case IFSTATE_TRUE: |
{ case IFSTATE_TRUE: |
ifstack->condstate = IFSTATE_STAYFALSE; |
ifstack->condstate = IFSTATE_STAYFALSE; |
break; |
break; |
case IFSTATE_FALSE: |
case IFSTATE_FALSE: |
ifstack->condstate = IFSTATE_TRUE; |
ifstack->condstate = IFSTATE_TRUE; |
break; |
break; |
} |
} |
#ifdef DEBUG_IF |
#ifdef DEBUG_IF |
if (debugging) |
if (debugging) |
{ outputs(" now "); |
{ outputs(" now "); |
output_ifstate(ifstack->condstate); |
output_ifstate(ifstack->condstate); |
outputc('>'); |
outputc('>'); |
fflush(outfile); |
fflush(outfile); |
} |
} |
#endif |
#endif |
} |
} |
else |
else |
{ |
{ |
#ifdef DEBUG_IF |
#ifdef DEBUG_IF |
if (debugging) |
if (debugging) |
{ outputs(" no if>"); |
{ outputs(" no if>"); |
fflush(outfile); |
fflush(outfile); |
} |
} |
#endif |
#endif |
err_head(); |
err_head(); |
fprintf(stderr,"if-less else\n"); |
fprintf(stderr,"if-less else\n"); |
Line 2245 void do_elif(int expr_sharp) |
|
Line 2245 void do_elif(int expr_sharp) |
|
if (sharp) |
if (sharp) |
{ d = '\0'; |
{ d = '\0'; |
do |
do |
{ c = d; |
{ c = d; |
d = Get(); |
d = Get(); |
} while ((c == '\\') || (d != '\n')); |
} while ((c == '\\') || (d != '\n')); |
} |
} |
return; |
return; |
} |
} |
Line 2260 void do_elif(int expr_sharp) |
|
Line 2260 void do_elif(int expr_sharp) |
|
ifstack->condstate = IFSTATE_STAYFALSE; |
ifstack->condstate = IFSTATE_STAYFALSE; |
#ifdef DEBUG_IF |
#ifdef DEBUG_IF |
if (debugging) |
if (debugging) |
{ outputs("forcing STAYFALSE>"); |
{ outputs("forcing STAYFALSE>"); |
fflush(outfile); |
fflush(outfile); |
} |
} |
#endif |
#endif |
return; |
return; |
} |
} |
Line 2289 void do_elif(int expr_sharp) |
|
Line 2289 void do_elif(int expr_sharp) |
|
break; |
break; |
case IFSTATE_FALSE: |
case IFSTATE_FALSE: |
if (e) |
if (e) |
{ ifstack->condstate = IFSTATE_TRUE; |
{ ifstack->condstate = IFSTATE_TRUE; |
} |
} |
break; |
break; |
} |
} |
#ifdef DEBUG_IF |
#ifdef DEBUG_IF |
Line 2440 void do_include(int expr_sharp) |
|
Line 2440 void do_include(int expr_sharp) |
|
DEF *d; |
DEF *d; |
cp = init_accum(); |
cp = init_accum(); |
while (issymchar(c)) |
while (issymchar(c)) |
{ accum_char(cp,c); |
{ accum_char(cp,c); |
c = Get(); |
c = Get(); |
} |
} |
Push(c); |
Push(c); |
cp = accum_result(cp); |
cp = accum_result(cp); |
d = find_def(cp); |
d = find_def(cp); |
if (d) |
if (d) |
{ expand_def(d); |
{ expand_def(d); |
n_hits ++; |
n_hits ++; |
} |
} |
else |
else |
{ char *dp; |
{ char *dp; |
for (dp=cp+strlen(cp);dp>cp;dp--) Push(*dp); |
for (dp=cp+strlen(cp);dp>cp;dp--) Push(*dp); |
n_misses ++; |
n_misses ++; |
} |
} |
} |
} |
else |
else |
{ break; |
{ break; |
Line 2465 void do_include(int expr_sharp) |
|
Line 2465 void do_include(int expr_sharp) |
|
{ while (1) |
{ while (1) |
{ c = Get(); |
{ c = Get(); |
if (c == '\n') |
if (c == '\n') |
{ Push('\n'); |
{ Push('\n'); |
c = '"'; |
c = '"'; |
err_head(); |
err_head(); |
fprintf(stderr,"warning: unterminated %cinclude filename\n", |
fprintf(stderr,"warning: unterminated %cinclude filename\n", |
sharp?'#':'@'); |
sharp?'#':'@'); |
} |
} |
if (c == '"') |
if (c == '"') |
{ break; |
{ break; |
} |
} |
accum_char(acc,c); |
accum_char(acc,c); |
} |
} |
if (sharp) |
if (sharp) |
Line 2485 void do_include(int expr_sharp) |
|
Line 2485 void do_include(int expr_sharp) |
|
{ while (1) |
{ while (1) |
{ c = Get(); |
{ c = Get(); |
if (c == '\n') |
if (c == '\n') |
{ Push('\n'); |
{ Push('\n'); |
c = '>'; |
c = '>'; |
err_head(); |
err_head(); |
fprintf(stderr,"warning: unterminated %cinclude filename\n", |
fprintf(stderr,"warning: unterminated %cinclude filename\n", |
sharp?'#':'@'); |
sharp?'#':'@'); |
} |
} |
if (c == '>') |
if (c == '>') |
{ break; |
{ break; |
} |
} |
accum_char(acc,c); |
accum_char(acc,c); |
} |
} |
if (sharp) |
if (sharp) |
Line 2552 void read_include_file(char *name, int dohere, int exp |
|
Line 2552 void read_include_file(char *name, int dohere, int exp |
|
{ int i; |
{ int i; |
n = temp; |
n = temp; |
for (i=0;i<nIfiles;i++) |
for (i=0;i<nIfiles;i++) |
{ sprintf(temp,"%s%c%s",Ifiles[i],DELIM,name); |
{ sprintf(temp,"%s%c%s",Ifiles[i],DELIM,name); |
f = fopen(temp,"r"); |
f = fopen(temp,"r"); |
if (f != NULL) |
if (f != NULL) |
{ break; |
{ break; |
} |
|
} |
|
} |
} |
} |
} |
|
} |
|
} |
if (f == NULL) |
if (f == NULL) |
{ err_head(); |
{ err_head(); |
fprintf(stderr,"can't find include file %s\n",name); |
fprintf(stderr,"can't find include file %s\n",name); |
Line 2617 char *cur_incldir; |
|
Line 2617 char *cur_incldir; |
|
int cur_lineno; |
int cur_lineno; |
|
|
typedef struct _mark { |
typedef struct _mark { |
struct _mark *link; |
struct _mark *link; |
char *acc; |
char *acc; |
int startdepth; |
int startdepth; |
int incs[MAXFILES]; |
int incs[MAXFILES]; |
int nincs; |
int nincs; |
int nignore; } MARK; |
int nignore; } MARK; |
|
|
static MARK *marks; |
static MARK *marks; |
static int atline; |
static int atline; |
|
|
while (1) |
while (1) |
{ if (cur_npushed > 0) |
{ if (cur_npushed > 0) |
{ do |
{ do |
{ c = GET(); |
{ c = GET(); |
} while (c == NOEXPAND); |
} while (c == NOEXPAND); |
if (c == MARKLINE) |
if (c == MARKLINE) |
{ mark_get_line(); |
{ mark_get_line(); |
continue; |
continue; |
} |
} |
mark_got_from_pushback(c); |
mark_got_from_pushback(c); |
#ifdef DEBUG_IO |
#ifdef DEBUG_IO |
if (debugging) |
if (debugging) |
{ outputc('('); |
{ outputc('('); |
outputs(unctrl(c)); |
outputs(unctrl(c)); |
outputc(')'); |
outputc(')'); |
fflush(outfile); |
fflush(outfile); |
} |
} |
#endif |
#endif |
break; |
break; |
} |
} |
else |
else |
{ c = getc(cur_fstack); |
{ c = getc(cur_fstack); |
if (feof(cur_fstack)) |
if (feof(cur_fstack)) |
{ if (fstackdepth > 0) |
{ if (fstackdepth > 0) |
{ |
{ |
#ifdef DEBUG_INCL |
#ifdef DEBUG_INCL |
if (debugging) |
if (debugging) |
{ outputs("--eof:"); |
{ outputs("--eof:"); |
outputs(cur_fn); |
outputs(cur_fn); |
outputs("--"); |
outputs("--"); |
} |
} |
#endif |
#endif |
fclose(cur_fstack); |
fclose(cur_fstack); |
free(cur_fn); |
free(cur_fn); |
free(cur_incldir); |
free(cur_incldir); |
change_fstackdepth(-1); |
change_fstackdepth(-1); |
mark_file_ending(); |
mark_file_ending(); |
out_at(cur_lineno,cur_fn); |
out_at(cur_lineno,cur_fn); |
autodef_file(curfile()); |
autodef_file(curfile()); |
autodef_line(curline()); |
autodef_line(curline()); |
continue; |
continue; |
} |
} |
else |
else |
{ flush_final_nl(); |
{ flush_final_nl(); |
save_stats(); |
save_stats(); |
#if 0 |
#if 0 |
exit(0); |
exit(0); |
#endif |
#endif |
longjmp(cpp_env,1); |
longjmp(cpp_env,1); |
} |
} |
} |
} |
mark_got_from_file(c); |
mark_got_from_file(c); |
#ifdef DEBUG_IO |
#ifdef DEBUG_IO |
if (debugging) |
if (debugging) |
{ outputc('<'); |
{ outputc('<'); |
outputs(unctrl(c)); |
outputs(unctrl(c)); |
outputc('>'); |
outputc('>'); |
fflush(outfile); |
fflush(outfile); |
} |
} |
#endif |
#endif |
break; |
break; |
} |
} |
Line 2856 char getnhsexpand(void) |
|
Line 2856 char getnhsexpand(void) |
|
if (expr_sharp && (c == '\\')) |
if (expr_sharp && (c == '\\')) |
{ c = Get(); |
{ c = Get(); |
if (c == '\n') |
if (c == '\n') |
{ continue; |
{ continue; |
} |
} |
else |
else |
{ Push(c); |
{ Push(c); |
c = '\\'; |
c = '\\'; |
} |
} |
} |
} |
break; |
break; |
} |
} |
Line 2880 char getexpand(void) |
|
Line 2880 char getexpand(void) |
|
{ char d; |
{ char d; |
d = Get(); |
d = Get(); |
if (d == '*') |
if (d == '*') |
{ d = '\0'; |
{ d = '\0'; |
do |
do |
{ c = d; |
{ c = d; |
d = Get(); |
d = Get(); |
} while ((c != '*') || (d != '/')); |
} while ((c != '*') || (d != '/')); |
continue; |
continue; |
} |
} |
else |
else |
{ Push(d); |
{ Push(d); |
return('/'); |
return('/'); |
} |
} |
} |
} |
else if (c == NOEXPAND) |
else if (c == NOEXPAND) |
{ c = Get(); |
{ c = Get(); |
if (issymchar(c)) |
if (issymchar(c)) |
{ Push(NOEXPAND); |
{ Push(NOEXPAND); |
} |
} |
return(c); |
return(c); |
} |
} |
else if (! isbsymchar(c)) |
else if (! isbsymchar(c)) |
Line 2916 char getexpand(void) |
|
Line 2916 char getexpand(void) |
|
else |
else |
{ int i; |
{ int i; |
for (i=strlen(str)-1;i>0;i--) |
for (i=strlen(str)-1;i>0;i--) |
{ Push(str[i]); |
{ Push(str[i]); |
} |
} |
Push(NOEXPAND); |
Push(NOEXPAND); |
c = str[0]; |
c = str[0]; |
free(str); |
free(str); |
Line 3001 void outputc(char c) |
|
Line 3001 void outputc(char c) |
|
{ atline += nnls; |
{ atline += nnls; |
nnls = 0; |
nnls = 0; |
if (no_line_lines) |
if (no_line_lines) |
{ fprintf(outfile,"\n"); |
{ fprintf(outfile,"\n"); |
} |
} |
else |
else |
{ fprintf(outfile,"\n# %d \"%s\"\n",atline,atfile); |
{ fprintf(outfile,"\n# %d \"%s\"\n",atline,atfile); |
} |
} |
done_line = 1; |
done_line = 1; |
} |
} |
for (;nnls;nnls--) |
for (;nnls;nnls--) |
Line 3107 void input_recover(void) |
|
Line 3107 void input_recover(void) |
|
while (m->nincs > 0) |
while (m->nincs > 0) |
{ l = m->incs[--m->nincs]; |
{ l = m->incs[--m->nincs]; |
for (;i>=l;i--) |
for (;i>=l;i--) |
{ Push(txt[i]); |
{ Push(txt[i]); |
} |
} |
Push(MARKLEND); |
Push(MARKLEND); |
c = txt[i]; |
c = txt[i]; |
for (i--;txt[i]!=c;i--) |
for (i--;txt[i]!=c;i--) |
{ Push(txt[i]); |
{ Push(txt[i]); |
} |
} |
Push('A'); |
Push('A'); |
Push('@'); |
Push('@'); |
Push('@'); |
Push('@'); |
Line 3163 void mark_file_ending(void) |
|
Line 3163 void mark_file_ending(void) |
|
{ to = m->incs[--m->nincs]; |
{ to = m->incs[--m->nincs]; |
acc = m->acc; |
acc = m->acc; |
for (i=accum_howfar(acc);i>to;i--) |
for (i=accum_howfar(acc);i>to;i--) |
{ accum_regret(acc); |
{ accum_regret(acc); |
} |
} |
} |
} |
} |
} |
} |
} |
|
|
char *incldep_o; |
char *incldep_o; |
int do_at_ctrls; |
int do_at_ctrls; |
extern char *predefs[]; |
extern char *predefs[]; |
|
|
#if defined(SYSV) |
#if defined(SYSV) |
void main(ac,av) |
void main(ac,av) |
#else |
#else |
Line 3315 void cpp_main(int ac, char **av) |
|
Line 3315 void cpp_main(int ac, char **av) |
|
int i; |
int i; |
|
|
if ( setjmp(cpp_env) ) { |
if ( setjmp(cpp_env) ) { |
if ( inf != stdin ) |
if ( inf != stdin ) |
fclose(inf); |
fclose(inf); |
if ( outf == stdout ) |
if ( outf == stdout ) |
fflush(outf); |
fflush(outf); |
else |
else |
fclose(outf); |
fclose(outf); |
return; |
return; |
} |
} |
|
|
init_symtbl(); |
init_symtbl(); |
#define predef(str) ( (cp=copyofstr("1")), \ |
#define predef(str) ( (cp=copyofstr("1")), \ |
check_malloc(cp), \ |
check_malloc(cp), \ |
define((str),-1,(unsigned char *)cp,DEF_PREDEF) ) |
define((str),-1,(unsigned char *)cp,DEF_PREDEF) ) |
for (i=0;predefs[i];i++) |
for (i=0;predefs[i];i++) |
{ predef(predefs[i]); |
{ predef(predefs[i]); |
} |
} |
Line 3344 void cpp_main(int ac, char **av) |
|
Line 3344 void cpp_main(int ac, char **av) |
|
{ if (**av == '-') |
{ if (**av == '-') |
{ rest = 0; |
{ rest = 0; |
if (!strcmp(*av,"-undef")) |
if (!strcmp(*av,"-undef")) |
{ undef_predefs(); |
{ undef_predefs(); |
} |
} |
else |
else |
{ for (++*av;(**av)&&!rest;++*av) |
{ for (++*av;(**av)&&!rest;++*av) |
{ switch (**av) |
{ switch (**av) |
{ case 'C': |
{ case 'C': |
keep_comments = 1; |
keep_comments = 1; |
break; |
break; |
case 'D': |
case 'D': |
rest = 1; |
rest = 1; |
++*av; |
++*av; |
if (strcmp(*av,"@") == 0) |
if (strcmp(*av,"@") == 0) |
{ do_at_ctrls = 1; |
{ do_at_ctrls = 1; |
} |
} |
else |
else |
{ cp = Index(*av,'='); |
{ cp = Index(*av,'='); |
if (cp) |
if (cp) |
{ if (cp != *av) |
{ if (cp != *av) |
{ char *dp; |
{ char *dp; |
*cp++ = '\0'; |
*cp++ = '\0'; |
dp = copyofstr(cp); |
dp = copyofstr(cp); |
check_malloc(dp); |
check_malloc(dp); |
define(*av,-1,(unsigned char *)dp,DEF_CMDLINE); |
define(*av,-1,(unsigned char *)dp,DEF_CMDLINE); |
} |
} |
else |
else |
{ fprintf(stderr,"Must give a name for -D\n"); |
{ fprintf(stderr,"Must give a name for -D\n"); |
} |
} |
} |
} |
else |
else |
{ char *dp; |
{ char *dp; |
dp = copyofstr("1"); |
dp = copyofstr("1"); |
check_malloc(dp); |
check_malloc(dp); |
define(*av,-1,(unsigned char *)dp,DEF_CMDLINE); |
define(*av,-1,(unsigned char *)dp,DEF_CMDLINE); |
} |
} |
} |
} |
break; |
break; |
case 'E': |
case 'E': |
break; |
break; |
case 'I': |
case 'I': |
rest = 1; |
rest = 1; |
++*av; |
++*av; |
if (**av) |
if (**av) |
{ Ifile(*av); |
{ Ifile(*av); |
} |
} |
else |
else |
{ fprintf(stderr,"Must give a directory name for -I\n"); |
{ fprintf(stderr,"Must give a directory name for -I\n"); |
} |
} |
break; |
break; |
case 'M': |
case 'M': |
incldep = 1; |
incldep = 1; |
break; |
break; |
case 'P': |
case 'P': |
no_line_lines = 1; |
no_line_lines = 1; |
break; |
break; |
case 'R': |
case 'R': |
break; |
break; |
case 'U': |
case 'U': |
rest = 1; |
rest = 1; |
++*av; |
++*av; |
if (**av) |
if (**av) |
{ undef(*av); |
{ undef(*av); |
} |
} |
else |
else |
{ fprintf(stderr,"Must give a name for -U\n"); |
{ fprintf(stderr,"Must give a name for -U\n"); |
} |
} |
break; |
break; |
default: |
default: |
fprintf(stderr,"Unknown flag -%c\n",**av); |
fprintf(stderr,"Unknown flag -%c\n",**av); |
break; |
break; |
} |
} |
} |
|
} |
|
} |
} |
|
} |
|
} |
else |
else |
{ switch (argno++) |
{ switch (argno++) |
{ case 0: |
{ case 0: |
if (strcmp(*av,"-") != 0) |
if (strcmp(*av,"-") != 0) |
{ FILE *f; |
{ FILE *f; |
f = fopen(*av,"r"); |
f = fopen(*av,"r"); |
if (f == NULL) |
if (f == NULL) |
{ fprintf(stderr,"Cannot open source file %s\n",*av); |
{ fprintf(stderr,"Cannot open source file %s\n",*av); |
} |
|
else |
|
{ inf = f; |
|
inname = *av; |
|
} |
|
} |
|
break; |
|
case 1: |
|
if (strcmp(*av,"-") != 0) |
|
{ FILE *f; |
|
f = fopen(*av,"w"); |
|
if (f == NULL) |
|
{ fprintf(stderr,"Can't create %s\n",*av); |
|
} |
|
else |
|
{ outf = f; |
|
} |
|
} |
|
break; |
|
default: |
|
fprintf(stderr,"Extra name %s ignored\n",*av); |
|
break; |
|
} |
|
} |
} |
|
else |
|
{ inf = f; |
|
inname = *av; |
|
} |
|
} |
|
break; |
|
case 1: |
|
if (strcmp(*av,"-") != 0) |
|
{ FILE *f; |
|
f = fopen(*av,"w"); |
|
if (f == NULL) |
|
{ fprintf(stderr,"Can't create %s\n",*av); |
|
} |
|
else |
|
{ outf = f; |
|
} |
|
} |
|
break; |
|
default: |
|
fprintf(stderr,"Extra name %s ignored\n",*av); |
|
break; |
} |
} |
|
} |
|
} |
if (incldep && !inname[0]) |
if (incldep && !inname[0]) |
{ fprintf(stderr,"No input file for -M flag\n"); |
{ fprintf(stderr,"No input file for -M flag\n"); |
#if 0 |
#if 0 |
exit(1); |
exit(1); |
#endif |
#endif |
longjmp(cpp_env,1); |
longjmp(cpp_env,1); |
} |
} |
if (do_at_ctrls) |
if (do_at_ctrls) |
{ predef("at_sign_ctrls"); |
{ predef("at_sign_ctrls"); |
Line 3516 void cpp_main(int ac, char **av) |
|
Line 3516 void cpp_main(int ac, char **av) |
|
if (!incldep && (isdigit(c) || (c == '.'))) |
if (!incldep && (isdigit(c) || (c == '.'))) |
{ haddigit = 0; |
{ haddigit = 0; |
while (isdigit(c) || (c == '.')) |
while (isdigit(c) || (c == '.')) |
{ haddigit |= isdigit(c); |
{ haddigit |= isdigit(c); |
maybe_print(c); |
maybe_print(c); |
c = Get(); |
c = Get(); |
} |
} |
if (haddigit && ((c == 'e') || (c == 'E'))) |
if (haddigit && ((c == 'e') || (c == 'E'))) |
{ maybe_print(c); |
{ maybe_print(c); |
c = Get(); |
c = Get(); |
while (isdigit(c)) |
while (isdigit(c)) |
{ maybe_print(c); |
{ maybe_print(c); |
c = Get(); |
c = Get(); |
} |
} |
} |
} |
Push(c); |
Push(c); |
continue; |
continue; |
} |
} |
if (quote) |
if (quote) |
{ if (c == '\\') |
{ if (c == '\\') |
{ maybe_print(c); |
{ maybe_print(c); |
backslash = 1; |
backslash = 1; |
continue; |
continue; |
} |
} |
else if ((c == quote) || (c == '\n')) |
else if ((c == quote) || (c == '\n')) |
{ maybe_print(c); |
{ maybe_print(c); |
quote = 0; |
quote = 0; |
continue; |
continue; |
} |
} |
else |
else |
{ maybe_print(c); |
{ maybe_print(c); |
continue; |
continue; |
} |
} |
} |
} |
if (c == '\\') /* this weirdness is Reiser semantics.... */ |
if (c == '\\') /* this weirdness is Reiser semantics.... */ |
{ backslash = 1; |
{ backslash = 1; |
Line 3564 void cpp_main(int ac, char **av) |
|
Line 3564 void cpp_main(int ac, char **av) |
|
} |
} |
else if (! incldep) |
else if (! incldep) |
{ if (isbsymchar(c) && !in_false_if()) |
{ if (isbsymchar(c) && !in_false_if()) |
{ char *cp; |
{ char *cp; |
DEF *d; |
DEF *d; |
cp = init_accum(); |
cp = init_accum(); |
while (issymchar(c)) |
while (issymchar(c)) |
{ accum_char(cp,c); |
{ accum_char(cp,c); |
c = Get(); |
c = Get(); |
} |
} |
Push(c); |
Push(c); |
cp = accum_result(cp); |
cp = accum_result(cp); |
#ifdef DEBUG_MAIN |
#ifdef DEBUG_MAIN |
if (debugging) |
if (debugging) |
{ outputs("<word:"); |
{ outputs("<word:"); |
outputs(cp); |
outputs(cp); |
outputs(">"); |
outputs(">"); |
} |
} |
#endif |
#endif |
d = find_def(cp); |
d = find_def(cp); |
if (d) |
if (d) |
{ expand_def(d); |
{ expand_def(d); |
n_hits ++; |
n_hits ++; |
} |
} |
else |
else |
{ for (;*cp;cp++) |
{ for (;*cp;cp++) |
{ maybe_print(*cp); |
{ maybe_print(*cp); |
} |
} |
n_misses ++; |
n_misses ++; |
} |
} |
} |
} |
else if (c == '/') |
else if (c == '/') |
{ char d; |
{ char d; |
d = Get(); |
d = Get(); |
if (d == '*') |
if (d == '*') |
{ d = '\0'; |
{ d = '\0'; |
if (keep_comments) |
if (keep_comments) |
{ maybe_print('/'); |
{ maybe_print('/'); |
maybe_print('*'); |
maybe_print('*'); |
} |
} |
do |
do |
{ c = d; |
{ c = d; |
d = Get(); |
d = Get(); |
if ((d == '\n') || keep_comments) |
if ((d == '\n') || keep_comments) |
{ maybe_print(d); |
{ maybe_print(d); |
} |
} |
} while ((c != '*') || (d != '/')); |
} while ((c != '*') || (d != '/')); |
} |
} |
else |
else |
{ Push(d); |
{ Push(d); |
maybe_print(c); |
maybe_print(c); |
} |
} |
} |
} |
else |
else |
{ maybe_print(c); |
{ maybe_print(c); |
} |
} |
} |
} |
} |
} |
} |
} |
Line 3644 void do_pragma(void) |
|
Line 3644 void do_pragma(void) |
|
} |
} |
|
|
char *predefs[] = { |
char *predefs[] = { |
"mc68000", |
"mc68000", |
"unix", |
"unix", |
"NeXT", |
"NeXT", |
"__MACH__", |
"__MACH__", |
0 |
0 |
}; |
}; |
|
|
void do_set(void) |
void do_set(void) |
Line 3729 void do_sharp(void) |
|
Line 3729 void do_sharp(void) |
|
if (strcmp(w,"") == 0) |
if (strcmp(w,"") == 0) |
{ c = Get(); |
{ c = Get(); |
if (c != '\n') |
if (c != '\n') |
{ Push(c); |
{ Push(c); |
} |
} |
else |
else |
{ isnull = 1; |
{ isnull = 1; |
} |
} |
} |
} |
if (!isnull && !in_false_if()) |
if (!isnull && !in_false_if()) |
{ err_head(); |
{ err_head(); |
Line 3766 void flush_sharp_line(void) |
|
Line 3766 void flush_sharp_line(void) |
|
} |
} |
if (comment) |
if (comment) |
{ if (c == '\\') |
{ if (c == '\\') |
{ backslash = 1; |
{ backslash = 1; |
} |
} |
else if ((c == '/') && (lastc == '*')) |
else if ((c == '/') && (lastc == '*')) |
{ comment = 0; |
{ comment = 0; |
} |
} |
continue; |
continue; |
} |
} |
if (quote) |
if (quote) |
{ if (c == '\\') |
{ if (c == '\\') |
{ backslash = 1; |
{ backslash = 1; |
} |
} |
else if (c == quote) |
else if (c == quote) |
{ quote = 0; |
{ quote = 0; |
} |
} |
} |
} |
switch (c) |
switch (c) |
{ case '\\': |
{ case '\\': |
backslash = 1; |
backslash = 1; |
continue; |
continue; |
break; |
break; |
case '"': case '\'': |
case '"': case '\'': |
quote = c; |
quote = c; |
continue; |
continue; |
break; |
break; |
case '*': |
case '*': |
comment = (lastc == '/'); |
comment = (lastc == '/'); |
continue; |
continue; |
break; |
break; |
default: |
default: |
continue; |
continue; |
break; |
break; |
case '\n': |
case '\n': |
break; |
break; |
} |
} |
break; |
break; |
} |
} |
Line 3825 void save_stats(void) |
|
Line 3825 void save_stats(void) |
|
f = fopen("/@larry/u1/mouse/Mouse-C/cpp.stats","a"); |
f = fopen("/@larry/u1/mouse/Mouse-C/cpp.stats","a"); |
if (f) |
if (f) |
{ fprintf(f,"%d def, %d undef, %d hits, %d misses\n", |
{ fprintf(f,"%d def, %d undef, %d hits, %d misses\n", |
n_defines,n_undefines,n_hits,n_misses); |
n_defines,n_undefines,n_hits,n_misses); |
fclose(f); |
fclose(f); |
} |
} |
} |
} |
Line 4003 void undef_predefs(void) |
|
Line 4003 void undef_predefs(void) |
|
while (*D) |
while (*D) |
{ d = *D; |
{ d = *D; |
if (d->how == DEF_PREDEF) |
if (d->how == DEF_PREDEF) |
{ free(d->name); |
{ free(d->name); |
free((char *)d->repl); |
free((char *)d->repl); |
*D = d->link; |
*D = d->link; |
OLD(d); |
OLD(d); |
n_in_table --; |
n_in_table --; |
} |
} |
else |
else |
{ D = &d->link; |
{ D = &d->link; |
} |
} |
} |
} |
} |
} |
} |
} |
|
|
char *_unctrl[0400] = { "^@", |
char *_unctrl[0400] = { "^@", |
"^A", |
"^A", |
"^B", |
"^B", |
"^C", |
"^C", |
"^D", |
"^D", |
"^E", |
"^E", |
"^F", |
"^F", |
"^G", |
"^G", |
"^H", |
"^H", |
"^I", |
"^I", |
"^J", |
"^J", |
"^K", |
"^K", |
"^L", |
"^L", |
"^M", |
"^M", |
"^N", |
"^N", |
"^O", |
"^O", |
"^P", |
"^P", |
"^Q", |
"^Q", |
"^R", |
"^R", |
"^S", |
"^S", |
"^T", |
"^T", |
"^U", |
"^U", |
"^V", |
"^V", |
"^W", |
"^W", |
"^X", |
"^X", |
"^Y", |
"^Y", |
"^Z", |
"^Z", |
"^[", |
"^[", |
"^\\", |
"^\\", |
"^]", |
"^]", |
"^^", |
"^^", |
"^_", |
"^_", |
" ", |
" ", |
"!", |
"!", |
"\"", |
"\"", |
"#", |
"#", |
"$", |
"$", |
"%", |
"%", |
"&", |
"&", |
"'", |
"'", |
"(", |
"(", |
")", |
")", |
"*", |
"*", |
"+", |
"+", |
",", |
",", |
"-", |
"-", |
".", |
".", |
"/", |
"/", |
"0", |
"0", |
"1", |
"1", |
"2", |
"2", |
"3", |
"3", |
"4", |
"4", |
"5", |
"5", |
"6", |
"6", |
"7", |
"7", |
"8", |
"8", |
"9", |
"9", |
":", |
":", |
";", |
";", |
"<", |
"<", |
"=", |
"=", |
">", |
">", |
"?", |
"?", |
"@", |
"@", |
"A", |
"A", |
"B", |
"B", |
"C", |
"C", |
"D", |
"D", |
"E", |
"E", |
"F", |
"F", |
"G", |
"G", |
"H", |
"H", |
"I", |
"I", |
"J", |
"J", |
"K", |
"K", |
"L", |
"L", |
"M", |
"M", |
"N", |
"N", |
"O", |
"O", |
"P", |
"P", |
"Q", |
"Q", |
"R", |
"R", |
"S", |
"S", |
"T", |
"T", |
"U", |
"U", |
"V", |
"V", |
"W", |
"W", |
"X", |
"X", |
"Y", |
"Y", |
"Z", |
"Z", |
"[", |
"[", |
"\\", |
"\\", |
"]", |
"]", |
"^", |
"^", |
"_", |
"_", |
"`", |
"`", |
"a", |
"a", |
"b", |
"b", |
"c", |
"c", |
"d", |
"d", |
"e", |
"e", |
"f", |
"f", |
"g", |
"g", |
"h", |
"h", |
"i", |
"i", |
"j", |
"j", |
"k", |
"k", |
"l", |
"l", |
"m", |
"m", |
"n", |
"n", |
"o", |
"o", |
"p", |
"p", |
"q", |
"q", |
"r", |
"r", |
"s", |
"s", |
"t", |
"t", |
"u", |
"u", |
"v", |
"v", |
"w", |
"w", |
"x", |
"x", |
"y", |
"y", |
"z", |
"z", |
"{"/*}*/, |
"{"/*}*/, |
"|", |
"|", |
/*{*/"}", |
/*{*/"}", |
"~", |
"~", |
"^?", |
"^?", |
"|^@", |
"|^@", |
"|^A", |
"|^A", |
"|^B", |
"|^B", |
"|^C", |
"|^C", |
"|^D", |
"|^D", |
"|^E", |
"|^E", |
"|^F", |
"|^F", |
"|^G", |
"|^G", |
"|^H", |
"|^H", |
"|^I", |
"|^I", |
"|^J", |
"|^J", |
"|^K", |
"|^K", |
"|^L", |
"|^L", |
"|^M", |
"|^M", |
"|^N", |
"|^N", |
"|^O", |
"|^O", |
"|^P", |
"|^P", |
"|^Q", |
"|^Q", |
"|^R", |
"|^R", |
"|^S", |
"|^S", |
"|^T", |
"|^T", |
"|^U", |
"|^U", |
"|^V", |
"|^V", |
"|^W", |
"|^W", |
"|^X", |
"|^X", |
"|^Y", |
"|^Y", |
"|^Z", |
"|^Z", |
"|^[", |
"|^[", |
"|^\\", |
"|^\\", |
"|^]", |
"|^]", |
"|^^", |
"|^^", |
"|^_", |
"|^_", |
"| ", |
"| ", |
"|!", |
"|!", |
"|\"", |
"|\"", |
"|#", |
"|#", |
"|$", |
"|$", |
"|%", |
"|%", |
"|&", |
"|&", |
"|'", |
"|'", |
"|(", |
"|(", |
"|)", |
"|)", |
"|*", |
"|*", |
"|+", |
"|+", |
"|,", |
"|,", |
"|-", |
"|-", |
"|.", |
"|.", |
"|/", |
"|/", |
"|0", |
"|0", |
"|1", |
"|1", |
"|2", |
"|2", |
"|3", |
"|3", |
"|4", |
"|4", |
"|5", |
"|5", |
"|6", |
"|6", |
"|7", |
"|7", |
"|8", |
"|8", |
"|9", |
"|9", |
"|:", |
"|:", |
"|;", |
"|;", |
"|<", |
"|<", |
"|=", |
"|=", |
"|>", |
"|>", |
"|?", |
"|?", |
"|@", |
"|@", |
"|A", |
"|A", |
"|B", |
"|B", |
"|C", |
"|C", |
"|D", |
"|D", |
"|E", |
"|E", |
"|F", |
"|F", |
"|G", |
"|G", |
"|H", |
"|H", |
"|I", |
"|I", |
"|J", |
"|J", |
"|K", |
"|K", |
"|L", |
"|L", |
"|M", |
"|M", |
"|N", |
"|N", |
"|O", |
"|O", |
"|P", |
"|P", |
"|Q", |
"|Q", |
"|R", |
"|R", |
"|S", |
"|S", |
"|T", |
"|T", |
"|U", |
"|U", |
"|V", |
"|V", |
"|W", |
"|W", |
"|X", |
"|X", |
"|Y", |
"|Y", |
"|Z", |
"|Z", |
"|[", |
"|[", |
"|\\", |
"|\\", |
"|]", |
"|]", |
"|^", |
"|^", |
"|_", |
"|_", |
"|`", |
"|`", |
"|a", |
"|a", |
"|b", |
"|b", |
"|c", |
"|c", |
"|d", |
"|d", |
"|e", |
"|e", |
"|f", |
"|f", |
"|g", |
"|g", |
"|h", |
"|h", |
"|i", |
"|i", |
"|j", |
"|j", |
"|k", |
"|k", |
"|l", |
"|l", |
"|m", |
"|m", |
"|n", |
"|n", |
"|o", |
"|o", |
"|p", |
"|p", |
"|q", |
"|q", |
"|r", |
"|r", |
"|s", |
"|s", |
"|t", |
"|t", |
"|u", |
"|u", |
"|v", |
"|v", |
"|w", |
"|w", |
"|x", |
"|x", |
"|y", |
"|y", |
"|z", |
"|z", |
"|{"/*}*/, |
"|{"/*}*/, |
"||", |
"||", |
/*{*/"|}", |
/*{*/"|}", |
"|~", |
"|~", |
"|^?" }; |
"|^?" }; |
|
|
char *_Unctrl[0400] = { "^@", |
char *_Unctrl[0400] = { "^@", |
"^A", |
"^A", |
"^B", |
"^B", |
"^C", |
"^C", |
"^D", |
"^D", |
"^E", |
"^E", |
"^F", |
"^F", |
"^G", |
"^G", |
"^H", |
"^H", |
"^I", |
"^I", |
"^J", |
"^J", |
"^K", |
"^K", |
"^L", |
"^L", |
"^M", |
"^M", |
"^N", |
"^N", |
"^O", |
"^O", |
"^P", |
"^P", |
"^Q", |
"^Q", |
"^R", |
"^R", |
"^S", |
"^S", |
"^T", |
"^T", |
"^U", |
"^U", |
"^V", |
"^V", |
"^W", |
"^W", |
"^X", |
"^X", |
"^Y", |
"^Y", |
"^Z", |
"^Z", |
"^[", |
"^[", |
"^\\", |
"^\\", |
"^]", |
"^]", |
"^^", |
"^^", |
"^_", |
"^_", |
"sp", |
"sp", |
"!", |
"!", |
"\"", |
"\"", |
"#", |
"#", |
"$", |
"$", |
"%", |
"%", |
"&", |
"&", |
"'", |
"'", |
"(", |
"(", |
")", |
")", |
"*", |
"*", |
"+", |
"+", |
",", |
",", |
"-", |
"-", |
".", |
".", |
"/", |
"/", |
"0", |
"0", |
"1", |
"1", |
"2", |
"2", |
"3", |
"3", |
"4", |
"4", |
"5", |
"5", |
"6", |
"6", |
"7", |
"7", |
"8", |
"8", |
"9", |
"9", |
":", |
":", |
";", |
";", |
"<", |
"<", |
"=", |
"=", |
">", |
">", |
"?", |
"?", |
"@", |
"@", |
"A", |
"A", |
"B", |
"B", |
"C", |
"C", |
"D", |
"D", |
"E", |
"E", |
"F", |
"F", |
"G", |
"G", |
"H", |
"H", |
"I", |
"I", |
"J", |
"J", |
"K", |
"K", |
"L", |
"L", |
"M", |
"M", |
"N", |
"N", |
"O", |
"O", |
"P", |
"P", |
"Q", |
"Q", |
"R", |
"R", |
"S", |
"S", |
"T", |
"T", |
"U", |
"U", |
"V", |
"V", |
"W", |
"W", |
"X", |
"X", |
"Y", |
"Y", |
"Z", |
"Z", |
"[", |
"[", |
"\\", |
"\\", |
"]", |
"]", |
"^", |
"^", |
"_", |
"_", |
"`", |
"`", |
"a", |
"a", |
"b", |
"b", |
"c", |
"c", |
"d", |
"d", |
"e", |
"e", |
"f", |
"f", |
"g", |
"g", |
"h", |
"h", |
"i", |
"i", |
"j", |
"j", |
"k", |
"k", |
"l", |
"l", |
"m", |
"m", |
"n", |
"n", |
"o", |
"o", |
"p", |
"p", |
"q", |
"q", |
"r", |
"r", |
"s", |
"s", |
"t", |
"t", |
"u", |
"u", |
"v", |
"v", |
"w", |
"w", |
"x", |
"x", |
"y", |
"y", |
"z", |
"z", |
"{"/*}*/, |
"{"/*}*/, |
"|", |
"|", |
/*{*/"}", |
/*{*/"}", |
"~", |
"~", |
"^?", |
"^?", |
"|^@", |
"|^@", |
"|^A", |
"|^A", |
"|^B", |
"|^B", |
"|^C", |
"|^C", |
"|^D", |
"|^D", |
"|^E", |
"|^E", |
"|^F", |
"|^F", |
"|^G", |
"|^G", |
"|^H", |
"|^H", |
"|^I", |
"|^I", |
"|^J", |
"|^J", |
"|^K", |
"|^K", |
"|^L", |
"|^L", |
"|^M", |
"|^M", |
"|^N", |
"|^N", |
"|^O", |
"|^O", |
"|^P", |
"|^P", |
"|^Q", |
"|^Q", |
"|^R", |
"|^R", |
"|^S", |
"|^S", |
"|^T", |
"|^T", |
"|^U", |
"|^U", |
"|^V", |
"|^V", |
"|^W", |
"|^W", |
"|^X", |
"|^X", |
"|^Y", |
"|^Y", |
"|^Z", |
"|^Z", |
"|^[", |
"|^[", |
"|^\\", |
"|^\\", |
"|^]", |
"|^]", |
"|^^", |
"|^^", |
"|^_", |
"|^_", |
"|sp", |
"|sp", |
"|!", |
"|!", |
"|\"", |
"|\"", |
"|#", |
"|#", |
"|$", |
"|$", |
"|%", |
"|%", |
"|&", |
"|&", |
"|'", |
"|'", |
"|(", |
"|(", |
"|)", |
"|)", |
"|*", |
"|*", |
"|+", |
"|+", |
"|,", |
"|,", |
"|-", |
"|-", |
"|.", |
"|.", |
"|/", |
"|/", |
"|0", |
"|0", |
"|1", |
"|1", |
"|2", |
"|2", |
"|3", |
"|3", |
"|4", |
"|4", |
"|5", |
"|5", |
"|6", |
"|6", |
"|7", |
"|7", |
"|8", |
"|8", |
"|9", |
"|9", |
"|:", |
"|:", |
"|;", |
"|;", |
"|<", |
"|<", |
"|=", |
"|=", |
"|>", |
"|>", |
"|?", |
"|?", |
"|@", |
"|@", |
"|A", |
"|A", |
"|B", |
"|B", |
"|C", |
"|C", |
"|D", |
"|D", |
"|E", |
"|E", |
"|F", |
"|F", |
"|G", |
"|G", |
"|H", |
"|H", |
"|I", |
"|I", |
"|J", |
"|J", |
"|K", |
"|K", |
"|L", |
"|L", |
"|M", |
"|M", |
"|N", |
"|N", |
"|O", |
"|O", |
"|P", |
"|P", |
"|Q", |
"|Q", |
"|R", |
"|R", |
"|S", |
"|S", |
"|T", |
"|T", |
"|U", |
"|U", |
"|V", |
"|V", |
"|W", |
"|W", |
"|X", |
"|X", |
"|Y", |
"|Y", |
"|Z", |
"|Z", |
"|[", |
"|[", |
"|\\", |
"|\\", |
"|]", |
"|]", |
"|^", |
"|^", |
"|_", |
"|_", |
"|`", |
"|`", |
"|a", |
"|a", |
"|b", |
"|b", |
"|c", |
"|c", |
"|d", |
"|d", |
"|e", |
"|e", |
"|f", |
"|f", |
"|g", |
"|g", |
"|h", |
"|h", |
"|i", |
"|i", |
"|j", |
"|j", |
"|k", |
"|k", |
"|l", |
"|l", |
"|m", |
"|m", |
"|n", |
"|n", |
"|o", |
"|o", |
"|p", |
"|p", |
"|q", |
"|q", |
"|r", |
"|r", |
"|s", |
"|s", |
"|t", |
"|t", |
"|u", |
"|u", |
"|v", |
"|v", |
"|w", |
"|w", |
"|x", |
"|x", |
"|y", |
"|y", |
"|z", |
"|z", |
"|{"/*}*/, |
"|{"/*}*/, |
"||", |
"||", |
/*{*/"|}", |
/*{*/"|}", |
"|~", |
"|~", |
"|^?" }; |
"|^?" }; |
|
|
void do_undef(int expr_sharp) |
void do_undef(int expr_sharp) |
{ |
{ |
Line 4542 void do_undef(int expr_sharp) |
|
Line 4542 void do_undef(int expr_sharp) |
|
} |
} |
else |
else |
{ if (undef(mac)) |
{ if (undef(mac)) |
{ n_undefines ++; |
{ n_undefines ++; |
} |
} |
} |
} |
} |
} |
if (sharp) |
if (sharp) |
Line 4588 void do_endwhile(void) |
|
Line 4588 void do_endwhile(void) |
|
|
|
char *Index(char *s, int c) |
char *Index(char *s, int c) |
{ |
{ |
return strchr(s,c); |
return strchr(s,c); |
} |
} |
|
|
char *Rindex(char *s, int c) |
char *Rindex(char *s, int c) |
{ |
{ |
return strrchr(s,c); |
return strrchr(s,c); |
} |
} |
|
|
void Bcopy(char *from, char *to, int len) |
void Bcopy(char *from, char *to, int len) |
{ |
{ |
#if defined(GO32) |
#if defined(GO32) |
bcopy(from,to,len); |
bcopy(from,to,len); |
#else |
#else |
memmove((void *)from,(void *)to,(int)len); |
memmove((void *)from,(void *)to,(int)len); |
#endif |
#endif |
} |
} |