/* * $XConsortium: cppsetup.c,v 1.4 88/09/06 17:53:45 jim Exp $ */ #include "def.h" #ifdef CPP /* * This file is strictly for the sake of cpy.y and yylex.c (if * you indeed have the source for cpp). */ #define IB 1 #define SB 2 #define NB 4 #define CB 8 #define QB 16 #define WB 32 #define SALT '#' #if pdp11 | vax | ns16000 | mc68000 | ibm032 #define COFF 128 #else #define COFF 0 #endif /* * These variables used by cpy.y and yylex.c */ extern char *outp, *inp, *newp, *pend; extern char *ptrtab; extern char fastab[]; extern char slotab[]; /* * cppsetup */ struct filepointer *currentfile; struct inclist *currentinc; cppsetup(line, filep, inc) register char *line; register struct filepointer *filep; register struct inclist *inc; { register char *p, savec; static boolean setupdone = FALSE; boolean value; if (!setupdone) { cpp_varsetup(); setupdone = TRUE; } currentfile = filep; currentinc = inc; inp = newp = line; for (p=newp; *p; p++) ; /* * put a newline back on the end, and set up pend, etc. */ *p++ = '\n'; savec = *p; *p = '\0'; pend = p; ptrtab = slotab+COFF; *--inp = SALT; outp=inp; value = yyparse(); *p = savec; return(value); } struct symtab *lookup(symbol) char *symbol; { static struct symtab undefined; struct symtab *sp; sp = defined(symbol, currentinc); if (sp == NULL) { sp = &undefined; sp->s_value = NULL; } return (sp); } pperror(tag, x0,x1,x2,x3,x4) int tag,x0,x1,x2,x3,x4; { log("\"%s\", line %d: ", currentinc->i_file, currentfile->f_line); log(x0,x1,x2,x3,x4); } yyerror(s) register char *s; { log_fatal("Fatal error: %s\n", s); } #endif CPP