Release 6
[unix-history] / usr / src / usr.bin / yacc / skeleton.c
index 9a72958..3d6ca10 100644 (file)
@@ -5,28 +5,17 @@
  * This code is derived from software contributed to Berkeley by
  * Robert Paul Corbett.
  *
  * This code is derived from software contributed to Berkeley by
  * Robert Paul Corbett.
  *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by the University of California, Berkeley.  The name of the
- * University may not be used to endorse or promote products derived
- * from this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ * %sccs.include.redist.c%
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)skeleton.c 5.2 (Berkeley) %G%";
+static char sccsid[] = "@(#)skeleton.c 5.6 (Berkeley) %G%";
 #endif /* not lint */
 
 #include "defs.h"
 
 #endif /* not lint */
 
 #include "defs.h"
 
-/*  The three line banner used here should be replaced with a one line */
-/*  #ident directive if the target C compiler supports #ident          */
-/*  directives.                                                                */
+/*  The banner used here should be replaced with an #ident directive   */
+/*  if the target C compiler supports #ident directives.               */
 /*                                                                     */
 /*  If the skeleton is changed, the banner should be changed so that   */
 /*  the altered version can easily be distinguished from the original. */
 /*                                                                     */
 /*  If the skeleton is changed, the banner should be changed so that   */
 /*  the altered version can easily be distinguished from the original. */
@@ -34,7 +23,27 @@ static char sccsid[] = "@(#)skeleton.c       5.2 (Berkeley) %G%";
 char *banner[] =
 {
     "#ifndef lint",
 char *banner[] =
 {
     "#ifndef lint",
-    "char yysccsid[] = \"@(#)yaccpar   1.1 (Berkeley) 12/10/89\";",
+    "static char yysccsid[] = \"@(#)yaccpar    1.8 (Berkeley) 01/20/90\";",
+    "#endif",
+    "#define YYBYACC 1",
+    0
+};
+
+
+char *tables[] =
+{
+    "extern short yylhs[];",
+    "extern short yylen[];",
+    "extern short yydefred[];",
+    "extern short yydgoto[];",
+    "extern short yysindex[];",
+    "extern short yyrindex[];",
+    "extern short yygindex[];",
+    "extern short yytable[];",
+    "extern short yycheck[];",
+    "#if YYDEBUG",
+    "extern char *yyname[];",
+    "extern char *yyrule[];",
     "#endif",
     0
 };
     "#endif",
     0
 };
@@ -44,11 +53,16 @@ char *header[] =
 {
     "#define yyclearin (yychar=(-1))",
     "#define yyerrok (yyerrflag=0)",
 {
     "#define yyclearin (yychar=(-1))",
     "#define yyerrok (yyerrflag=0)",
-    "#ifndef YYSTACKSIZE",
+    "#ifdef YYSTACKSIZE",
+    "#ifndef YYMAXDEPTH",
+    "#define YYMAXDEPTH YYSTACKSIZE",
+    "#endif",
+    "#else",
     "#ifdef YYMAXDEPTH",
     "#define YYSTACKSIZE YYMAXDEPTH",
     "#else",
     "#ifdef YYMAXDEPTH",
     "#define YYSTACKSIZE YYMAXDEPTH",
     "#else",
-    "#define YYSTACKSIZE 300",
+    "#define YYSTACKSIZE 500",
+    "#define YYMAXDEPTH 500",
     "#endif",
     "#endif",
     "int yydebug;",
     "#endif",
     "#endif",
     "int yydebug;",
@@ -59,9 +73,9 @@ char *header[] =
     "YYSTYPE *yyvsp;",
     "YYSTYPE yyval;",
     "YYSTYPE yylval;",
     "YYSTYPE *yyvsp;",
     "YYSTYPE yyval;",
     "YYSTYPE yylval;",
-    "#define yystacksize YYSTACKSIZE",
     "short yyss[YYSTACKSIZE];",
     "YYSTYPE yyvs[YYSTACKSIZE];",
     "short yyss[YYSTACKSIZE];",
     "YYSTYPE yyvs[YYSTACKSIZE];",
+    "#define yystacksize YYSTACKSIZE",
     0
 };
 
     0
 };
 
@@ -82,9 +96,7 @@ char *body[] =
     "    if (yys = getenv(\"YYDEBUG\"))",
     "    {",
     "        yyn = *yys;",
     "    if (yys = getenv(\"YYDEBUG\"))",
     "    {",
     "        yyn = *yys;",
-    "        if (yyn == '0')",
-    "            yydebug = 0;",
-    "        else if (yyn >= '1' && yyn <= '9')",
+    "        if (yyn >= '0' && yyn <= '9')",
     "            yydebug = yyn - '0';",
     "    }",
     "#endif",
     "            yydebug = yyn - '0';",
     "    }",
     "#endif",
@@ -224,7 +236,7 @@ char *trailer[] =
     "    yym = yylhs[yyn];",
     "    if (yystate == 0 && yym == 0)",
     "    {",
     "    yym = yylhs[yyn];",
     "    if (yystate == 0 && yym == 0)",
     "    {",
-    "#ifdef YYDEBUG",
+    "#if YYDEBUG",
     "        if (yydebug)",
     "            printf(\"yydebug: after reduction, shifting from state 0 to\\",
     " state %d\\n\", YYFINAL);",
     "        if (yydebug)",
     "            printf(\"yydebug: after reduction, shifting from state 0 to\\",
     " state %d\\n\", YYFINAL);",
@@ -254,7 +266,7 @@ char *trailer[] =
     "        yystate = yytable[yyn];",
     "    else",
     "        yystate = yydgoto[yym];",
     "        yystate = yytable[yyn];",
     "    else",
     "        yystate = yydgoto[yym];",
-    "#ifdef YYDEBUG",
+    "#if YYDEBUG",
     "    if (yydebug)",
     "        printf(\"yydebug: after reduction, shifting from state %d \\",
     "to state %d\\n\", *yyssp, yystate);",
     "    if (yydebug)",
     "        printf(\"yydebug: after reduction, shifting from state %d \\",
     "to state %d\\n\", *yyssp, yystate);",
@@ -281,10 +293,12 @@ write_section(section)
 char *section[];
 {
     register int i;
 char *section[];
 {
     register int i;
+    register FILE *fp;
 
 
+    fp = code_file;
     for (i = 0; section[i]; ++i)
     {
        ++outline;
     for (i = 0; section[i]; ++i)
     {
        ++outline;
-       fprintf(output_file, "%s\n", section[i]);
+       fprintf(fp, "%s\n", section[i]);
     }
 }
     }
 }