30 #pragma warning(disable : 4996)
50 #if pdp11 | vax | ns16000 | mc68000 | ibm032
58 extern char *outp, *inp, *newp, *pend;
72 register char *p, savec;
73 static bool setupdone =
false;
103 struct symtab *lookup(
char *symbol)
105 static struct symtab undefined;
108 sp =
isdefined(symbol, currentinc, NULL);
116 int pperror(
int tag,
int x0,
int x1,
int x2,
int x3,
int x4)
123 int yyerror(
register char *s)
140 static const char *_my_if_errors(
IfParser *ip,
const char *cp,
141 const char *expecting)
143 struct _parse_data *pd = (
struct _parse_data *) ip->
data;
144 int lineno = pd->filep->f_line;
145 char *filename = pd->inc->i_file;
150 sprintf (prefix,
"\"%s\":%d", filename, lineno);
151 prefixlen = int(strlen(prefix));
152 fprintf (stderr,
"%s: %s", prefix, pd->line);
153 i = int(cp - pd->line);
154 if (i > 0 && pd->line[i-1] !=
'\n') {
157 for (i += prefixlen + 3; i > 0; i--) {
160 fprintf (stderr,
"^--- expecting %s\n", expecting);
165 #define MAXNAMELEN 256
167 static struct symtab *_lookup_variable(
IfParser *ip,
const char *var,
int len)
170 struct _parse_data *pd = (
struct _parse_data *) ip->
data;
175 strncpy (tmpbuf, var, len);
177 return isdefined (tmpbuf, pd->inc, NULL);
181 static int _my_eval_defined(
IfParser *ip,
const char *var,
int len)
183 if (_lookup_variable (ip, var, len))
return 1;
187 #define isvarfirstletter(ccc) (isalpha(ccc) || (ccc) == '_')
189 static int _my_eval_variable(
IfParser *ip,
const char *var,
int len)
193 s = _lookup_variable (ip, var, len);
200 s = _lookup_variable (ip, var,
int(strlen(var)));
211 struct _parse_data pd;
220 ip.
data = (
char *) &pd;
#define isvarfirstletter(ccc)
int cppsetup(register char *line, register struct filepointer *filep, register inclist *inc)
symtab * isdefined(register char *symbol, inclist *file, inclist **srcfile)
const char * ParseIfExpression(IfParser *g, const char *cp, int *valp)
void fatalerr(char *msg, x1, x2, x3, x4, x5, x6, x7, x8, x9)
void warning(const char *msg, x1, x2, x3, x4, x5, x6, x7, x8, x9)
int(* eval_variable)(IfParser *, const char *, int)
int(* eval_defined)(IfParser *, const char *, int)
struct IfParser::@0 funcs
const char *(* handle_error)(IfParser *, const char *, const char *)