|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 1989 The Regents of the University of California. ! 3: * All rights reserved. ! 4: * ! 5: * This code is derived from software contributed to Berkeley by ! 6: * Robert Paul Corbett. ! 7: * ! 8: * Redistribution and use in source and binary forms are permitted provided ! 9: * that: (1) source distributions retain this entire copyright notice and ! 10: * comment, and (2) distributions including binaries display the following ! 11: * acknowledgement: ``This product includes software developed by the ! 12: * University of California, Berkeley and its contributors'' in the ! 13: * documentation or other materials provided with the distribution and in ! 14: * all advertising materials mentioning features or use of this software. ! 15: * Neither the name of the University nor the names of its contributors may ! 16: * be used to endorse or promote products derived from this software without ! 17: * specific prior written permission. ! 18: * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED ! 19: * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF ! 20: * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ! 21: */ ! 22: ! 23: #ifndef lint ! 24: static char sccsid[] = "@(#)skeleton.c 5.5 (Berkeley) 6/1/90"; ! 25: #endif /* not lint */ ! 26: ! 27: #include "defs.h" ! 28: ! 29: /* The three line banner used here should be replaced with a one line */ ! 30: /* #ident directive if the target C compiler supports #ident */ ! 31: /* directives. */ ! 32: /* */ ! 33: /* If the skeleton is changed, the banner should be changed so that */ ! 34: /* the altered version can easily be distinguished from the original. */ ! 35: ! 36: char *banner[] = ! 37: { ! 38: "#ifndef lint", ! 39: "char yysccsid[] = \"@(#)yaccpar 1.4 (Berkeley) 02/25/90\";", ! 40: "#endif", ! 41: 0 ! 42: }; ! 43: ! 44: ! 45: char *header[] = ! 46: { ! 47: "#define yyclearin (yychar=(-1))", ! 48: "#define yyerrok (yyerrflag=0)", ! 49: "#ifndef YYSTACKSIZE", ! 50: "#ifdef YYMAXDEPTH", ! 51: "#define YYSTACKSIZE YYMAXDEPTH", ! 52: "#else", ! 53: "#define YYSTACKSIZE 300", ! 54: "#endif", ! 55: "#endif", ! 56: "int yydebug;", ! 57: "int yynerrs;", ! 58: "int yyerrflag;", ! 59: "int yychar;", ! 60: "short *yyssp;", ! 61: "YYSTYPE *yyvsp;", ! 62: "YYSTYPE yyval;", ! 63: "YYSTYPE yylval;", ! 64: "#define yystacksize YYSTACKSIZE", ! 65: "short yyss[YYSTACKSIZE];", ! 66: "YYSTYPE yyvs[YYSTACKSIZE];", ! 67: 0 ! 68: }; ! 69: ! 70: ! 71: char *body[] = ! 72: { ! 73: "#define YYABORT goto yyabort", ! 74: "#define YYACCEPT goto yyaccept", ! 75: "#define YYERROR goto yyerrlab", ! 76: "int", ! 77: "yyparse()", ! 78: "{", ! 79: " register int yym, yyn, yystate;", ! 80: "#if YYDEBUG", ! 81: " register char *yys;", ! 82: " extern char *getenv();", ! 83: "", ! 84: " if (yys = getenv(\"YYDEBUG\"))", ! 85: " {", ! 86: " yyn = *yys;", ! 87: " if (yyn >= '0' && yyn <= '9')", ! 88: " yydebug = yyn - '0';", ! 89: " }", ! 90: "#endif", ! 91: "", ! 92: " yynerrs = 0;", ! 93: " yyerrflag = 0;", ! 94: " yychar = (-1);", ! 95: "", ! 96: " yyssp = yyss;", ! 97: " yyvsp = yyvs;", ! 98: " *yyssp = yystate = 0;", ! 99: "", ! 100: "yyloop:", ! 101: " if (yyn = yydefred[yystate]) goto yyreduce;", ! 102: " if (yychar < 0)", ! 103: " {", ! 104: " if ((yychar = yylex()) < 0) yychar = 0;", ! 105: "#if YYDEBUG", ! 106: " if (yydebug)", ! 107: " {", ! 108: " yys = 0;", ! 109: " if (yychar <= YYMAXTOKEN) yys = yyname[yychar];", ! 110: " if (!yys) yys = \"illegal-symbol\";", ! 111: " printf(\"yydebug: state %d, reading %d (%s)\\n\", yystate,", ! 112: " yychar, yys);", ! 113: " }", ! 114: "#endif", ! 115: " }", ! 116: " if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&", ! 117: " yyn <= YYTABLESIZE && yycheck[yyn] == yychar)", ! 118: " {", ! 119: "#if YYDEBUG", ! 120: " if (yydebug)", ! 121: " printf(\"yydebug: state %d, shifting to state %d\\n\",", ! 122: " yystate, yytable[yyn]);", ! 123: "#endif", ! 124: " if (yyssp >= yyss + yystacksize - 1)", ! 125: " {", ! 126: " goto yyoverflow;", ! 127: " }", ! 128: " *++yyssp = yystate = yytable[yyn];", ! 129: " *++yyvsp = yylval;", ! 130: " yychar = (-1);", ! 131: " if (yyerrflag > 0) --yyerrflag;", ! 132: " goto yyloop;", ! 133: " }", ! 134: " if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&", ! 135: " yyn <= YYTABLESIZE && yycheck[yyn] == yychar)", ! 136: " {", ! 137: " yyn = yytable[yyn];", ! 138: " goto yyreduce;", ! 139: " }", ! 140: " if (yyerrflag) goto yyinrecovery;", ! 141: "#ifdef lint", ! 142: " goto yynewerror;", ! 143: "#endif", ! 144: "yynewerror:", ! 145: " yyerror(\"syntax error\");", ! 146: "#ifdef lint", ! 147: " goto yyerrlab;", ! 148: "#endif", ! 149: "yyerrlab:", ! 150: " ++yynerrs;", ! 151: "yyinrecovery:", ! 152: " if (yyerrflag < 3)", ! 153: " {", ! 154: " yyerrflag = 3;", ! 155: " for (;;)", ! 156: " {", ! 157: " if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 &&", ! 158: " yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)", ! 159: " {", ! 160: "#if YYDEBUG", ! 161: " if (yydebug)", ! 162: " printf(\"yydebug: state %d, error recovery shifting\\", ! 163: " to state %d\\n\", *yyssp, yytable[yyn]);", ! 164: "#endif", ! 165: " if (yyssp >= yyss + yystacksize - 1)", ! 166: " {", ! 167: " goto yyoverflow;", ! 168: " }", ! 169: " *++yyssp = yystate = yytable[yyn];", ! 170: " *++yyvsp = yylval;", ! 171: " goto yyloop;", ! 172: " }", ! 173: " else", ! 174: " {", ! 175: "#if YYDEBUG", ! 176: " if (yydebug)", ! 177: " printf(\"yydebug: error recovery discarding state %d\ ! 178: \\n\",", ! 179: " *yyssp);", ! 180: "#endif", ! 181: " if (yyssp <= yyss) goto yyabort;", ! 182: " --yyssp;", ! 183: " --yyvsp;", ! 184: " }", ! 185: " }", ! 186: " }", ! 187: " else", ! 188: " {", ! 189: " if (yychar == 0) goto yyabort;", ! 190: "#if YYDEBUG", ! 191: " if (yydebug)", ! 192: " {", ! 193: " yys = 0;", ! 194: " if (yychar <= YYMAXTOKEN) yys = yyname[yychar];", ! 195: " if (!yys) yys = \"illegal-symbol\";", ! 196: " printf(\"yydebug: state %d, error recovery discards token %d\ ! 197: (%s)\\n\",", ! 198: " yystate, yychar, yys);", ! 199: " }", ! 200: "#endif", ! 201: " yychar = (-1);", ! 202: " goto yyloop;", ! 203: " }", ! 204: "yyreduce:", ! 205: "#if YYDEBUG", ! 206: " if (yydebug)", ! 207: " printf(\"yydebug: state %d, reducing by rule %d (%s)\\n\",", ! 208: " yystate, yyn, yyrule[yyn]);", ! 209: "#endif", ! 210: " yym = yylen[yyn];", ! 211: " yyval = yyvsp[1-yym];", ! 212: " switch (yyn)", ! 213: " {", ! 214: 0 ! 215: }; ! 216: ! 217: ! 218: char *trailer[] = ! 219: { ! 220: " }", ! 221: " yyssp -= yym;", ! 222: " yystate = *yyssp;", ! 223: " yyvsp -= yym;", ! 224: " yym = yylhs[yyn];", ! 225: " if (yystate == 0 && yym == 0)", ! 226: " {", ! 227: "#ifdef YYDEBUG", ! 228: " if (yydebug)", ! 229: " printf(\"yydebug: after reduction, shifting from state 0 to\\", ! 230: " state %d\\n\", YYFINAL);", ! 231: "#endif", ! 232: " yystate = YYFINAL;", ! 233: " *++yyssp = YYFINAL;", ! 234: " *++yyvsp = yyval;", ! 235: " if (yychar < 0)", ! 236: " {", ! 237: " if ((yychar = yylex()) < 0) yychar = 0;", ! 238: "#if YYDEBUG", ! 239: " if (yydebug)", ! 240: " {", ! 241: " yys = 0;", ! 242: " if (yychar <= YYMAXTOKEN) yys = yyname[yychar];", ! 243: " if (!yys) yys = \"illegal-symbol\";", ! 244: " printf(\"yydebug: state %d, reading %d (%s)\\n\",", ! 245: " YYFINAL, yychar, yys);", ! 246: " }", ! 247: "#endif", ! 248: " }", ! 249: " if (yychar == 0) goto yyaccept;", ! 250: " goto yyloop;", ! 251: " }", ! 252: " if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&", ! 253: " yyn <= YYTABLESIZE && yycheck[yyn] == yystate)", ! 254: " yystate = yytable[yyn];", ! 255: " else", ! 256: " yystate = yydgoto[yym];", ! 257: "#ifdef YYDEBUG", ! 258: " if (yydebug)", ! 259: " printf(\"yydebug: after reduction, shifting from state %d \\", ! 260: "to state %d\\n\", *yyssp, yystate);", ! 261: "#endif", ! 262: " if (yyssp >= yyss + yystacksize - 1)", ! 263: " {", ! 264: " goto yyoverflow;", ! 265: " }", ! 266: " *++yyssp = yystate;", ! 267: " *++yyvsp = yyval;", ! 268: " goto yyloop;", ! 269: "yyoverflow:", ! 270: " yyerror(\"yacc stack overflow\");", ! 271: "yyabort:", ! 272: " return (1);", ! 273: "yyaccept:", ! 274: " return (0);", ! 275: "}", ! 276: 0 ! 277: }; ! 278: ! 279: ! 280: write_section(section) ! 281: char *section[]; ! 282: { ! 283: register int i; ! 284: ! 285: for (i = 0; section[i]; ++i) ! 286: { ! 287: ++outline; ! 288: fprintf(output_file, "%s\n", section[i]); ! 289: } ! 290: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.