From f74070010575435f0e6e77986b886c0a8a555002 Mon Sep 17 00:00:00 2001 From: Oliver Lehmann Date: Thu, 8 Feb 1990 06:19:35 +0000 Subject: [PATCH] ING_DB --- WEGA/contrib/ingres/dbs/src/conf/conf.h | 395 +++++++++++++ WEGA/contrib/ingres/dbs/src/yyyacc/y2.c | 717 ++++++++++++++++++++++++ 2 files changed, 1112 insertions(+) create mode 100644 WEGA/contrib/ingres/dbs/src/conf/conf.h create mode 100644 WEGA/contrib/ingres/dbs/src/yyyacc/y2.c diff --git a/WEGA/contrib/ingres/dbs/src/conf/conf.h b/WEGA/contrib/ingres/dbs/src/conf/conf.h new file mode 100644 index 0000000..3dfdd82 --- /dev/null +++ b/WEGA/contrib/ingres/dbs/src/conf/conf.h @@ -0,0 +1,395 @@ +# include "../conf/m.h" + +/* MACHINE DEPENDENCIES */ +/* user defined */ +/* AMX_SC: AMX seperate compiling */ +/* DBS_LOCK: /dev/DB_LOCK available */ +/* DBS_MAJOR: major device number of DB_LOCK */ +/* DBS_UID: uid of BS-user DBS */ +/* LOCKS: no of concurrent used DB's */ +/* STRIPFLAG: strip load modules */ + +/* define FLAGS here */ +# define AMX_SC +# define DBS_LOCK +# define DBS_MAJOR 10 +# define DBS_UID 9 +# define LOCKS 15 +# define STRIPFLAG -s + + +/* MACHINE DEPENDENCIES */ +/* system defined */ +/* AMX_QRYMOD: AMX query modification support */ +/* BIT_32: 32-bit wordsize */ +/* BMOVE: no assembler text for bmove() */ +/* CODE: limitted code (4KByte) */ +/* DBU_SEPERATE: seperate dbu modules */ +/* DIR_BSD4: BSD 4.x file system */ +/* DISK: default floppy disk */ +/* DYSIZE: no lib function for dysize() */ +/* D_ALIGN: alignment % 8 needed */ +/* EBCDIC: EBCDIC character set */ +/* ENUM_INT: enumeration are int's */ +/* ESER: ESER runtime support */ +/* F77: FORTRAN 77 support */ +/* FP_PROCESSOR: floating point processor */ +/* FREAD: using fread(III) */ +/* FWRITE: using fwrite(III) */ +/* ID_SEPERATE: seperate I/D available */ +/* L_ALIGN: alignment % 4 needed */ +/* MEM_E: enough memory: 32-bit addresses */ +/* MEM_N: not enough memory: 64KBytes */ +/* MEM_S: segmented memory */ +/* MEM_O: overlayed memory: bsd 2.9 */ +/* NO_F4: no float's (float = double) */ +/* NO_KILL: kill(2) not available */ +/* NO_PIPE: pipe(2) not available */ +/* NON_V7_FS: non BS V7 file system */ +/* OD_SEPERATE: seperate ovqp/decomp modules */ +/* OS_DIR: name of the configuration dir */ +/* OS_LIB: name of the device library */ +/* OS_NAME: name of the operating system */ +/* PAGE_LOCKING: enable page locking level */ +/* PGBLKS: no of 512-bytes blocks per page */ +/* RANLIB: ranlib available */ +/* REV_BYTES: revers bytes in word */ +/* REV_WORDS: revers words in long word */ +/* SETBUF: using setbuf(III) */ +/* SIGN_EXT: sign extension (char -> int) */ +/* STACK: limitted stack (4KByte) */ +/* S_ALIGN: alignment % 2 needed */ +/* TEXT_SEPERATE: seperate text segment available */ +/* YACC_OPTIM: cant't optimize y.tab.c */ + + +# ifdef A7150 +# define EC1834 +# endif + +# ifdef BC +# define DBU_SEPERATE +# define MACHINE "BC 5120.16" +# define MEM_N +# define OD_SEPERATE +# define PGBLKS 2 +# define SETBUF +# define S_ALIGN 0 +# define YACC_OPTIM +# endif + +# ifdef BDS +# define DBU_SEPERATE +# define MACHINE "BDS A 5230" +# define MEM_N +# define OD_SEPERATE +# define PGBLKS 2 +# define SETBUF +# define S_ALIGN 0 +# define YACC_OPTIM +# define BC +# endif + +# ifdef CM1420 +# define MACHINE "CM1420" +# define PDP +# endif + +# ifdef CM4 +# define MACHINE "SM4-20" +# define PDP +# endif + +# ifdef CM52_11 +# define MACHINE "SM 52/11" +# define PDP +# endif + +# ifdef EC1834 +# undef mutos +# define BMOVE +# ifdef TRACE +# define DBU_SEPERATE +# endif +# define FP_PROCESSOR +# define ID_SEPERATE +# define MACHINE "EC 1834" +# ifdef TRACE +# define OD_SEPERATE +# endif +# define OS_DIR /usr/sys/conf +# define OS_LIB /usr/sys/io +# define OS_NAME mutos +# define PGBLKS 2 +# define RANLIB +# define REV_BYTES +# define SIGN_EXT +# define S_ALIGN 0 +# endif + +# ifdef HP_UX +# define BIT_32 +# define BMOVE +# define DIR_BSD4 +# define DYSIZE +# define FP_PROCESSOR +# define L_ALIGN 0 +# define MACHINE "HP 9000" +# define MEM_E +# define NON_V7_FS +# define PGBLKS 8 +/* # define RANLIB already did, see AR(1) */ +# define SETBUF +# define SIGN_EXT +# define TEXT_SEPERATE +# endif + +# ifdef I100 +# define MACHINE "I100" +# define PDP +# endif + +# ifdef I102 +# define MACHINE "I102" +# define PDP +# endif + +# ifdef I105 +# define MACHINE "I105" +# define PDP +# endif + +# ifdef K1630 +# define MACHINE "K 1630" +# define PDP +# endif + +# ifdef K1820 +# define MACHINE "K 1820" +# define VAX +# endif + +# ifdef K1840 +# define MACHINE "K 1840" +# define VAX +# endif + +# ifdef P8000 +# define ID_SEPERATE +# define MACHINE "P8000" +# define MEM_S +# define OS_DIR /usr/sys/conf +# define OS_LIB /usr/sys/dev/LIB2 +# define OS_NAME wega +# define PGBLKS 2 +# define SETBUF +# define SIGN_EXT +# define S_ALIGN 0 +# define TEXT_SEPERATE +# endif + +# ifdef PDP34 +# define MACHINE "PDP 11/34" +# define PDP +# endif + +# ifdef PDP70 +# define FP_PROCESSOR +# define ID_SEPERATE +# define MACHINE "PDP 11/70" +# define PGBLKS 2 +# define RANLIB +# define REV_BYTES +# define SETBUF +# define SIGN_EXT +# define S_ALIGN 0 +# endif + +# ifdef PSU_1040 +# define ESER_PSU +# define MACHINE "EC 1040" +# endif + +# ifdef PSU_1056 +# define ESER_PSU +# define MACHINE "EC 1056" +# endif + +# ifdef PSU_1057 +# define ESER_PSU +# define MACHINE "EC 1057" +# endif + +# ifdef VENIX +# define BMOVE +# ifdef TRACE +# define DBU_SEPERATE +# endif +# define FP_PROCESSOR +# define ID_SEPERATE +# define MACHINE "PC 1640" +# define OD_SEPERATE +# define PGBLKS 2 +# define RANLIB +# define REV_BYTES +# define REV_WORDS +# define SETBUF +# define SIGN_EXT +# define STACK +# define S_ALIGN 0 +# endif + +# ifdef VMX_1056 +# define ESER_VMX +# define MACHINE "EC 1056" +# endif + +# ifdef VMX_1057 +# define ESER_VMX +# define MACHINE "EC 1057" +# endif + +# ifdef XENIX286 +# define BMOVE +# define FP_PROCESSOR +# define ID_SEPERATE +# define MACHINE "IBM/AT" +# define PGBLKS 2 +# define RANLIB +# define REV_BYTES +# define REV_WORDS +# define SETBUF +# define SIGN_EXT +# define S_ALIGN 0 +# define YACC_OPTIM +# endif + +# ifdef XENIX386 +# define BIT_32 +# define BMOVE +# define FP_PROCESSOR +# define ID_SEPERATE +# define L_ALIGN 0 +# define MACHINE "I 80386" +# define MEM_E +# define PGBLKS 8 +# define RANLIB +# define REV_BYTES +# define REV_WORDS +# define SIGN_EXT +# endif + + +/* NO REAL MACHINES: */ +/* ESER_PSU == EC 10.. (PSU) */ +/* ESER_VMX == EC 10.. (VMX) */ +/* ESER == EC 10.. */ +/* MSDOS == IBM/XT, IBM/AT */ +/* PDP == PDP11/34, K1630, SM4-20, I100 ... */ +/* VAX == K1820, K1840 ... */ + +# ifdef ESER_PSU +# define CODE +# define DYSIZE +# define D_ALIGN 1 +# define EBCDIC +# define ESER +# define NO_F4 +# define NO_KILL +# define NO_PIPE +# define STACK +# define YACC_OPTIM +# endif + +# ifdef ESER_VMX +# define ENUM_INT +# define ESER +# define L_ALIGN 0 +# define lseek seek +# endif + +# ifdef ESER +# define BIT_32 +# define BMOVE +# define FP_PROCESSOR +# define MEM_E +# define PGBLKS 8 +# define RANLIB +# define SETBUF +# define TEXT_SEPERATE +# endif + +# ifdef MSDOS +# define FP_PROCESSOR +# define MEM_S +# define PGBLKS 2 +# define REV_BYTES +# define REV_WORDS +# define SETBUF +# define SIGN_EXT +# define S_ALIGN 0 +# endif + +# ifdef PDP +# define DBU_SEPERATE +# define F77 +# define FP_PROCESSOR +# define MEM_N +# define MEM_O +# define OD_SEPERATE +# define PGBLKS 2 +# define REV_BYTES +# define SETBUF +# define SIGN_EXT +# define S_ALIGN 0 +# define TEXT_SEPERATE +# endif + +# ifdef VAX +# define BIT_32 +# define DIR_BSD4 +# define DYSIZE +# define FP_PROCESSOR +# define L_ALIGN 0 +# define MEM_E +# define NON_V7_FS +# define PGBLKS 8 +# define RANLIB +# define REV_BYTES +# define REV_WORDS +# define SETBUF +# define SIGN_EXT +# undef vax +# endif + + +# ifdef ESER_PSU +# define CP -cp +# else +# define CP cp +# endif +# define LN ln +# define DISK /dev/dbs + + +/* */ +/* SIGN EXTENSION DEFINITIONS */ +/* */ +/* ctoi: char to (signed) integer */ +/* ctou: char to unsigned integer */ +/* */ + +# ifdef SIGN_EXT +# define ctoi(val) (val) +# else +# define ctoi(val) AAi1toi2(val) +# endif + +# define ctou(val) ((val) & 0377) + + +/* */ +/* MACRO processor available ? */ +/* */ + +# define MACRO diff --git a/WEGA/contrib/ingres/dbs/src/yyyacc/y2.c b/WEGA/contrib/ingres/dbs/src/yyyacc/y2.c new file mode 100644 index 0000000..637098a --- /dev/null +++ b/WEGA/contrib/ingres/dbs/src/yyyacc/y2.c @@ -0,0 +1,717 @@ +# include +# include "../conf/gen.h" +# include "y.h" + +extern FILE *Fout, *Fin; +extern FILE *copen(); + +# define IDENTIFIER 257 +# define MARK 258 +# define TERM 259 +# define LEFT 260 +# define BINARY 261 +# define RIGHT 262 +# define PREC 263 +# define LCURLY 264 +# define C_IDENTIFIER 265 /* name followed by colon */ +# define NUMBER 266 + +# ifdef ESER_PSU +# define DEV_NULL "/NULLFILE" +# else +# define DEV_NULL "/dev/null" +# endif + +setup(argc, argv) +register int argc; +register char **argv; +{ + register int i; + register int j; + register int lev; + register int t; + register int c; + + Foutput = (FILE *) 0; + i = 1; + while (argc >= 2 && argv[1][0] == '-') + { + while (*++(argv[1])) + { + switch(*argv[1]) + { + case 'v': + case 'V': + Foutput = copen("y.output", "w"); + continue; + + case 's': + case 'S': + sflag = 1; + continue; + + default: + error("illegal option: %c", *argv[1]); + } + } + argv++; + argc--; + } + + if (Foutput == (FILE *) 0) + Foutput = copen(DEV_NULL, "w"); + ftable = copen("y.tab.c", "w"); + if (argc > 1) + cin = copen(argv[1], "r"); + settab(); + fprintf(Fout, "#\n"); + ctokn = "$end"; + defin(0); /* eof */ + extval = 0400; /* beginning of assigned values */ + ctokn = "error"; + defin(0); + ctokn = "$accept"; + defin(1); + mem = mem0; + cnamp = cnames; + lev = 0; + i = 0; + + while (t = gettok()) + { + switch(t) + { + case IDENTIFIER: + j = chFind(0); + trmlev[j] = lev; + continue; + + case ',': + case ';': + continue; + + case TERM: + lev = 0; + continue; + + case LEFT: + lev = (++i << 3) | 01; + continue; + + case BINARY: + lev = (++i << 3) | 02; + continue; + + case RIGHT: + lev = (++i << 3) | 03; + continue; + + case MARK: + deFout(); + fprintf(Fout, "# define\tyyclearin\t\t(yychar = -1)\n"); + fprintf(Fout, "# define\tyyerrok\t\t\t(yyerrflag = 0)\n"); + fprintf(Fout, "extern int\tyychar;\n"); + fprintf(Fout, "extern int\tyyerrflag;\n"); + fprintf(Fout, "\nchar\t\t*yyval = (char *) 0;\n"); + fprintf(Fout, "char\t\t**yypv;\n"); + fprintf(Fout, "char\t\t*yylval = (char *) 0;\n"); + fprintf(Fout, "\nyyactr(__np__)\n"); + fprintf(Fout, "register int\t__np__;\n"); + fprintf(Fout, "{\n"); + break; + + case LCURLY: + deFout(); + cpycode(); + continue; + + case NUMBER: + trmset[j].value = numbval; + if (j < ndeFout && j > 2) + error("please define type # of %s earlier", trmset[j].name); + continue; + + default: + error("bad precedence syntax, input %d", t); + } + break; + } + prdptr[0] = mem; + /* added production */ + *mem++ = NTBASE; + *mem++ = NTBASE+1; + *mem++ = 1; + *mem++ = 0; + prdptr[1] = mem; + i = 0; + + /* i is 0 when a rule can begin, 1 otherwise */ + + for ( ; ; ) + { + switch(t = gettok()) + { + case C_IDENTIFIER: + if (mem == prdptr[1]) /* first time */ + fprintf(Fout, "switch(__np__){\n"); + if (i != 0) + error("previous rule not terminated"); + *mem = chFind(1); + if (*mem < NTBASE) + error("token illegal on lhs of grammar rule"); + i = 1; + ++mem; + continue; + + case IDENTIFIER: + *mem = chFind(1); + if (*mem < NTBASE) + levprd[nprod] = trmlev[*mem]; + mem++; + if (i == 0) + error("missing :"); + continue; + case '=': + + levprd[nprod] |= 04; + if (i == 0) + error("semicolon preceeds action"); + fprintf(Fout, "\n case %d:", nprod); + cpyact(); + fprintf(Fout, " break;"); + + case '|': + case ';': + if (i) + { + *mem++ = -nprod; + prdptr[++nprod] = mem; + levprd[nprod] = 0; + i = 0; + } + if (t == '|') + { + i = 1; + *mem++ = *prdptr[nprod - 1]; + } + continue; + + case 0: /* End Of File */ + case MARK: + if (i != 0) + error("rule not terminated before %%%% or EOF"); + settab(); + Finact(); + /* copy the programs which follow the rules */ + if (t == MARK) + while ((c = getc(Fin)) > 0) + putc(c, Fout); + return; + + case PREC: + if (i == 0) + error("%%prec must appear inside rule"); + if (gettok() != IDENTIFIER) + error("illegal %%prec syntax"); + j = chFind(2); + if (j >= NTBASE) + error("nonterminal %s illegal after %%prec", + nontrst[j - NTBASE].name); + levprd[nprod] = trmlev[j]; + continue; + + case LCURLY: + if (i != 0) + error("%%{ appears within a rule"); + cpycode(); + continue; + + default: + error("syntax error, input %d", t ); + } + } +} + +Finact() +{ + /* Finish action routine */ + /* ------- The next line is an DBS customization ------- */ + fprintf(Fout, "\n}\nreturn (0);\n}\n"); + fprintf(Fout, "int\t\tyyerrval = %d;\n", trmset[2].value); +} + +defin(t) +register int t; +{ + /* define ctokn to be a terminal if t = 0 + or a nonterminal if t = 1 */ + if (t) + { + if (++nnonter >= ntlim) + error("too many nonterminals, limit %d", ntlim); + nontrst[nnonter].name = ctokn; + return (NTBASE + nnonter); + } + else + { + if (++nterms >= tlim) + error("too many terminals, limit %d", tlim); + trmset[nterms].name = ctokn; + if (ctokn[0] == ' ' && ctokn[2]=='\0') /* single character literal */ + trmset[nterms].value = ctokn[1]; + else if (ctokn[0] == ' ' && ctokn[1]=='\\') + { /* escape sequence */ + if (ctokn[3] == '\0') + { /* single character escape sequence */ + switch (ctokn[2]) + { + /* character which is escaped */ + case 'n': + trmset[nterms].value = '\n'; + break; + + case 'r': + trmset[nterms].value = '\r'; + break; + + case 'b': + trmset[nterms].value = '\b'; + break; + + case 't': + trmset[nterms].value = '\t'; + break; + + case '\'': + trmset[nterms].value = '\''; + break; + + case '"': + trmset[nterms].value = '"'; + break; + + case '\\': + trmset[nterms].value = '\\'; + break; + + default: + error("invalid escape"); + } + } + else if (ctokn[2] <= '7' && ctokn[2] >= '0') + { /* \nnn sequence */ + if (ctokn[3] < '0' || ctokn[3] > '7' || ctokn[4] < '0' || + ctokn[4] > '7' || ctokn[5] != '\0') + error("illegal \\nnn construction"); + trmset[nterms].value = 64 * (ctokn[2] - '0') + 8 * (ctokn[3] - '0') + ctokn[4] - '0'; + if (trmset[nterms].value == 0) + error("'\\000' is illegal"); + } + } + else + trmset[nterms].value = extval++; + trmlev[nterms] = 0; + return (nterms); + } +} + +deFout() +{ + /* write out the defines (at the end of the declaration section) */ + + register int i; + register int c; + register char *cp; + + for (i = ndeFout; i <= nterms; ++i) + { + cp = trmset[i].name; + if (*cp == ' ') + ++cp; /* literals */ + + for ( ; (c= *cp) != '\0'; ++cp) + { + if (c >= 'a' && c <= 'z' || + c >= 'A' && c <= 'Z' || + c >= '0' && c <= '9' || + c == '_') + ; /* VOID */ + else + goto nodef; + } + + /* define it */ + fprintf(Fout, "# define\t%-20s\t%d\n", trmset[i].name, trmset[i].value); +nodef: + ; + } + + ndeFout = nterms + 1; +} + +chstash(c) +register int c; +{ + /* put character away into cnames */ + if (cnamp >= &cnames[cnamsz]) + error("too many characters in id's and literals"); + else + *cnamp++ = c; +} + +gettok() +{ + register int base; + register int c; + register int match; + register int reserve; + static int peekline; /* number of '\n' seen in lookahead */ + +begin: + reserve = 0; + if (peekc >= 0) + { + c = peekc; + lineno += peekline; + peekc = -1; + peekline = 0; + } + else + c = getc(Fin); + while (c == ' ' || c=='\n' || c=='\t') + { + if (c == '\n') + ++lineno; + c = getc(Fin); + } + if (c == '/') + { + if (getc(Fin) != '*') + error("illegal /"); + c = getc(Fin); + while (c) + { + if (c == '\n') + ++lineno; + if (c == '*') + { + if ((c = getc(Fin)) == '/') + break; + } + else + c = getc(Fin); + } + if (!c) + return (0); + goto begin; + } + switch(c) + { + case '"': + case '\'': + match = c; + ctokn = cnamp; + chstash(' '); + while (1) + { + c = getc(Fin); + if (c == '\n' || c == '\0') + error("illegal or missing ' or \""); + if (c == '\\') + { + c = getc(Fin); + chstash('\\'); + } + else if (c == match) + break; + chstash(c); + } + break; + + case '%': + case '\\': + switch(c = getc(Fin)) + { + case '0': + return (TERM); + + case '<': + return (LEFT); + + case '2': + return (BINARY); + + case '>': + return (RIGHT); + + case '%': + case '\\': + return (MARK); + + case '=': + return (PREC); + + case '{': + return (LCURLY); + + default: + reserve = 1; + } + + default: + if (c >= '0' && c <= '9') + { /* number */ + numbval = c - '0' ; + base = (c == '0')? 8: 10; + for (c = getc(Fin); c >= '0' && c <= '9'; c = getc(Fin)) + numbval = numbval * base + c - '0'; + peekc = c; + return (NUMBER); + } + else if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '_' || c == '.' || c == '$') + { + ctokn = cnamp; + while ( (c >= 'a' && c <= 'z') || + (c >= 'A' && c <= 'Z') || + (c >= '0' && c <= '9') || + c == '_' || c =='.' || c =='$') + { + chstash(c); + if (peekc >= 0) + { + c = peekc; + peekc = -1; + } + else + c = getc(Fin); + } + } + else + return (c); + + peekc = c; + } + chstash('\0'); + + if (reserve) + { /* Find a reserved word */ + if (compare("term")) + return (TERM); + if (compare("TERM")) + return (TERM); + if (compare("token")) + return (TERM); + if (compare("TOKEN")) + return (TERM); + if (compare("left")) + return (LEFT); + if (compare("LEFT")) + return (LEFT); + if (compare("nonassoc")) + return (BINARY); + if (compare("NONASSOC")) + return (BINARY); + if (compare("binary")) + return (BINARY); + if (compare("BINARY")) + return (BINARY); + if (compare("right")) + return (RIGHT); + if (compare("RIGHT")) + return (RIGHT); + if (compare("prec")) + return (PREC); + if (compare("PREC")) + return (PREC); + error("invalid escape, or illegal reserved word: %s", ctokn); + } + + /* look ahead to distinguish IDENTIFIER from C_IDENTIFIER */ + while (peekc == ' ' || peekc=='\t' || peekc == '\n') + { + if (peekc == '\n') + ++peekline; + peekc = getc(Fin); + } + + if (peekc != ':') + return (IDENTIFIER); + peekc = -1; + lineno += peekline; + peekline = 0; + return (C_IDENTIFIER); +} + +chFind(t) +register int t; +{ + register int i; + + if (ctokn[0] == ' ') + t = 0; + for (i = 1; i <= nterms; i++) + if (compare(trmset[i].name)) + { + cnamp = ctokn; + return (i); + } + for (i = 1; i <= nnonter; i++) + if (compare(nontrst[i].name)) + { + cnamp = ctokn; + return (i + NTBASE); + } + /* cannot Find name */ + if (t > 1 && ctokn[0] != ' ') + error("%s should have been defined earlier", ctokn); + return (defin(t)); +} + +cpycode() +{ + /* copies code between \{ and \} */ + register int c; + + c = getc(Fin); + if (c == '\n') + { + c = getc(Fin); + lineno++; + } + while (c) + { + if (c == '\\') + if ((c = getc(Fin)) == '}') + return; + else + putc('\\', Fout); + if (c == '%') + if ((c = getc(Fin)) == '}') + return; + else + putc('%', Fout); + putc(c, Fout); + if (c == '\n') + ++lineno; + c = getc(Fin); + } + error("eof before %%}"); +} + +cpyact() +{ + /* copy C action to the next ; or closing } */ + register int brac; + register int c; + register int match; + register int j; + register int s; + + brac = 0; +loop: + c = getc(Fin); +swt: + switch(c) + { + case ';': + if (brac == 0) + { + putc(c, Fout); + return; + } + goto lcopy; + + case '{': + brac++; + goto lcopy; + + case '$': + s = 1; + c = getc(Fin); + if (c == '$') + { + fprintf(Fout, "yyval"); + goto loop; + } + if (c == '-') + { + s = -s; + c = getc(Fin); + } + if (c >= '0' && c <= '9') + { + j = 0; + while (c >= '0' && c <= '9') + { + j = j * 10 + c - '0'; + c = getc(Fin); + } + fprintf(Fout, "yypv[%d]", s * j); + goto swt; + } + putc('$', Fout); + if (s < 0) + putc('-', Fout); + goto swt; + + case '}': + brac--; + if (brac == 0) + { + putc(c, Fout); + return; + } + goto lcopy; + + case '/': /* look for comments */ + putc(c, Fout); + c = getc(Fin); + if (c != '*') goto swt; + + /* it really is a comment */ + putc(c, Fout); + while ((c = getc(Fin)) > 0) + { + if (c == '*') + { + putc(c, Fout); + if ((c = getc(Fin)) == '/') + goto lcopy; + } + putc(c, Fout); + } + error("EOF inside comment"); + + case '\'': /* character constant */ + match = '\''; + goto string; + + case '"': /* character string */ + match = '"'; +string: + putc(c, Fout); + while ((c = getc(Fin)) > 0) + { + if (c == '\\') + { + putc(c, Fout); + c = getc(Fin); + } + else if (c == match) + goto lcopy; + putc(c, Fout); + } + error("EOF in string or character constant"); + + case '\0': + error("action does not terminate"); + + case '\n': + ++lineno; + goto lcopy; + + } +lcopy: + putc(c, Fout); + goto loop; +}