diff --git a/src/toolsComm/antelope/output.c b/src/toolsComm/antelope/output.c index 88c77b52f..7e2b76cf6 100644 --- a/src/toolsComm/antelope/output.c +++ b/src/toolsComm/antelope/output.c @@ -106,7 +106,7 @@ output_rule_data() register int j; - fprintf(output_file, "short %slhs[] = {%42d,", symbol_prefix, + fprintf(output_file, "static short %slhs[] = {%42d,", symbol_prefix, symbol_value[start_symbol]); j = 10; @@ -126,7 +126,7 @@ output_rule_data() if (!rflag) outline += 2; fprintf(output_file, "\n};\n"); - fprintf(output_file, "short %slen[] = {%42d,", symbol_prefix, 2); + fprintf(output_file, "static short %slen[] = {%42d,", symbol_prefix, 2); j = 10; for (i = 3; i < nrules; i++) @@ -151,7 +151,7 @@ output_yydefred() { register int i, j; - fprintf(output_file, "short %sdefred[] = {%39d,", symbol_prefix, + fprintf(output_file, "static short %sdefred[] = {%39d,", symbol_prefix, (defred[0] ? defred[0] - 2 : 0)); j = 10; @@ -293,7 +293,7 @@ goto_actions() state_count = NEW2(nstates, short); k = default_goto(start_symbol + 1); - fprintf(output_file, "short %sdgoto[] = {%40d,", symbol_prefix, k); + fprintf(output_file, "static short %sdgoto[] = {%40d,", symbol_prefix, k); save_column(start_symbol + 1, k); j = 10; @@ -617,7 +617,7 @@ output_base() { register int i, j; - fprintf(output_file, "short %ssindex[] = {%39d,", symbol_prefix, base[0]); + fprintf(output_file, "static short %ssindex[] = {%39d,", symbol_prefix, base[0]); j = 10; for (i = 1; i < nstates; i++) @@ -635,7 +635,7 @@ output_base() } if (!rflag) outline += 2; - fprintf(output_file, "\n};\nshort %srindex[] = {%39d,", symbol_prefix, + fprintf(output_file, "\n};\nstatic short %srindex[] = {%39d,", symbol_prefix, base[nstates]); j = 10; @@ -654,7 +654,7 @@ output_base() } if (!rflag) outline += 2; - fprintf(output_file, "\n};\nshort %sgindex[] = {%39d,", symbol_prefix, + fprintf(output_file, "\n};\nstatic short %sgindex[] = {%39d,", symbol_prefix, base[2*nstates]); j = 10; @@ -686,7 +686,7 @@ output_table() ++outline; fprintf(code_file, "#define YYTABLESIZE %d\n", high); - fprintf(output_file, "short %stable[] = {%40d,", symbol_prefix, + fprintf(output_file, "static short %stable[] = {%40d,", symbol_prefix, table[0]); j = 10; @@ -716,7 +716,7 @@ output_check() register int i; register int j; - fprintf(output_file, "short %scheck[] = {%40d,", symbol_prefix, + fprintf(output_file, "static short %scheck[] = {%40d,", symbol_prefix, check[0]); j = 10; @@ -819,7 +819,7 @@ output_defines() if (union_file == NULL) open_error(union_file_name); while ((c = getc(union_file)) != EOF) putc(c, defines_file); - fprintf(defines_file, " YYSTYPE;\nextern YYSTYPE %slval;\n", + fprintf(defines_file, " YYSTYPE;\nstatic YYSTYPE %slval;\n", symbol_prefix); } } @@ -885,7 +885,7 @@ output_debug() symnam[0] = "end-of-file"; if (!rflag) ++outline; - fprintf(output_file, "#if YYDEBUG\nchar *%sname[] = {", symbol_prefix); + fprintf(output_file, "#if YYDEBUG\nstatic char *%sname[] = {", symbol_prefix); j = 80; for (i = 0; i <= max; ++i) { @@ -1011,7 +1011,7 @@ output_debug() FREE(symnam); if (!rflag) ++outline; - fprintf(output_file, "char *%srule[] = {\n", symbol_prefix); + fprintf(output_file, "static char *%srule[] = {\n", symbol_prefix); for (i = 2; i < nrules; ++i) { fprintf(output_file, "\"%s :", symbol_name[rlhs[i]]); diff --git a/src/toolsComm/antelope/skeleton.c b/src/toolsComm/antelope/skeleton.c index d2b6c9f09..f9d0de03e 100644 --- a/src/toolsComm/antelope/skeleton.c +++ b/src/toolsComm/antelope/skeleton.c @@ -15,7 +15,7 @@ char *banner[] = { "#ifndef lint", - "static char yysccsid[] = \"@(#)yaccpar 1.9 (Berkeley) 02/21/93\";", + "static char yysccsid[] = \"@(#)yaccpar (JRW version from 1.9 (Berkeley) 02/21/93)\";", "#endif", "#define YYBYACC 1", "#define YYMAJOR 1", @@ -23,24 +23,29 @@ char *banner[] = "#define yyclearin (yychar=(-1))", "#define yyerrok (yyerrflag=0)", "#define YYRECOVERING (yyerrflag!=0)", + "#ifdef __STDC__", /* JRW */ + "static int yyparse(void);",/* JRW */ + "#else", /* JRW */ + "static int yyparse();", /* JRW */ + "#endif", /* JRW */ 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[];", + "static short yylhs[];", /* JRW */ + "static short yylen[];", /* JRW */ + "static short yydefred[];", /* JRW */ + "static short yydgoto[];", /* JRW */ + "static short yysindex[];", /* JRW */ + "static short yyrindex[];", /* JRW */ + "static short yygindex[];", /* JRW */ + "static short yytable[];", /* JRW */ + "static short yycheck[];", /* JRW */ "#if YYDEBUG", - "extern char *yyname[];", - "extern char *yyrule[];", + "static char *yyname[];", /* JRW */ + "static char *yyrule[];", /* JRW */ "#endif", 0 }; @@ -59,16 +64,16 @@ char *header[] = "#define YYMAXDEPTH 500", "#endif", "#endif", - "int yydebug;", - "int yynerrs;", - "int yyerrflag;", - "int yychar;", - "short *yyssp;", - "YYSTYPE *yyvsp;", - "YYSTYPE yyval;", - "YYSTYPE yylval;", - "short yyss[YYSTACKSIZE];", - "YYSTYPE yyvs[YYSTACKSIZE];", + "static int yydebug;", /* JRW */ + "static int yynerrs;", /* JRW */ + "static int yyerrflag;", /* JRW */ + "static int yychar;", /* JRW */ + "static short *yyssp;", /* JRW */ + "static YYSTYPE *yyvsp;", /* JRW */ + "static YYSTYPE yyval;", /* JRW */ + "static YYSTYPE yylval;", /* JRW */ + "static short yyss[YYSTACKSIZE];", /* JRW */ + "static YYSTYPE yyvs[YYSTACKSIZE];", /* JRW */ "#define yystacksize YYSTACKSIZE", 0 }; @@ -80,8 +85,13 @@ char *body[] = "#define YYREJECT goto yyabort", "#define YYACCEPT goto yyaccept", "#define YYERROR goto yyerrlab", - "int", - "yyparse()", + "#ifdef __STDC__", /* JRW */ + "static int", /* JRW */ + "yyparse(void)", /* JRW */ + "#else", /* JRW */ + "static int", /* JRW */ + "yyparse()", /* JRW */ + "#endif", /* JRW */ "{", " register int yym, yyn, yystate;", "#if YYDEBUG",