|
|
1.1 ! root 1: /* ! 2: * $Header: cppsetup.c,v 1.2 87/08/07 00:23:56 toddb Exp $ ! 3: * ! 4: * $Log: cppsetup.c,v $ ! 5: * Revision 1.2 87/08/07 00:23:56 toddb ! 6: * Added ibm032 to #if line for COFF. ! 7: * ! 8: * Revision 1.1 87/04/08 16:40:33 rich ! 9: * Initial revision ! 10: * ! 11: * Revision 1.3 86/09/15 17:34:42 toddb ! 12: * Added mc68000 to the list of machines with #define COFF 128. ! 13: * ! 14: * Revision 1.2 86/09/04 09:54:10 toddb ! 15: * lookup() returned NULL if a symbol was not defined. However, yylex() ! 16: * expected a pointer but with a null value. The effect was that vaxes ! 17: * didn't work because referece through a null pointer gave a "defined" ! 18: * result; merlins and stratos worked just fine. ! 19: * ! 20: * Revision 1.1 86/04/15 08:34:15 toddb ! 21: * Initial revision ! 22: * ! 23: */ ! 24: #include "def.h" ! 25: ! 26: #ifdef CPP ! 27: /* ! 28: * This file is strictly for the sake of cpy.y and yylex.c (if ! 29: * you indeed have the source for cpp). ! 30: */ ! 31: #define IB 1 ! 32: #define SB 2 ! 33: #define NB 4 ! 34: #define CB 8 ! 35: #define QB 16 ! 36: #define WB 32 ! 37: #define SALT '#' ! 38: #if pdp11 | vax | ns16000 | mc68000 | ibm032 ! 39: #define COFF 128 ! 40: #else ! 41: #define COFF 0 ! 42: #endif ! 43: /* ! 44: * These variables used by cpy.y and yylex.c ! 45: */ ! 46: extern char *outp, *inp, *newp, *pend; ! 47: extern char *ptrtab; ! 48: extern char fastab[]; ! 49: extern char slotab[]; ! 50: ! 51: /* ! 52: * cppsetup ! 53: */ ! 54: struct filepointer *currentfile; ! 55: struct inclist *currentinc; ! 56: ! 57: cppsetup(line, filep, inc) ! 58: register char *line; ! 59: register struct filepointer *filep; ! 60: register struct inclist *inc; ! 61: { ! 62: register char *p, savec; ! 63: static boolean setupdone = FALSE; ! 64: boolean value; ! 65: ! 66: if (!setupdone) { ! 67: cpp_varsetup(); ! 68: setupdone = TRUE; ! 69: } ! 70: ! 71: currentfile = filep; ! 72: currentinc = inc; ! 73: inp = newp = line; ! 74: for (p=newp; *p; p++) ! 75: ; ! 76: ! 77: /* ! 78: * put a newline back on the end, and set up pend, etc. ! 79: */ ! 80: *p++ = '\n'; ! 81: savec = *p; ! 82: *p = '\0'; ! 83: pend = p; ! 84: ! 85: ptrtab = slotab+COFF; ! 86: *--inp = SALT; ! 87: outp=inp; ! 88: value = yyparse(); ! 89: *p = savec; ! 90: return(value); ! 91: } ! 92: ! 93: struct symtab *lookup(symbol) ! 94: char *symbol; ! 95: { ! 96: static struct symtab undefined; ! 97: struct symtab *sp; ! 98: ! 99: sp = defined(symbol, currentinc); ! 100: if (sp == NULL) { ! 101: sp = &undefined; ! 102: sp->s_value = NULL; ! 103: } ! 104: return (sp); ! 105: } ! 106: ! 107: pperror(tag, x0,x1,x2,x3,x4) ! 108: int tag,x0,x1,x2,x3,x4; ! 109: { ! 110: log("\"%s\", line %d: ", currentinc->i_file, currentfile->f_line); ! 111: log(x0,x1,x2,x3,x4); ! 112: } ! 113: ! 114: ! 115: yyerror(s) ! 116: register char *s; ! 117: { ! 118: log_fatal("Fatal error: %s\n", s); ! 119: } ! 120: #endif CPP
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.