mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
* src/output.c: Formatting changes.
* src/machine.h: Remove, leaving its contents in... * src/system.h: here. Include stdio.h. Adjust all dependencies on stdio.h and machine.h. * src/getargs.h: New file. Let all `extern' declarations about getargs.c be replaced with inclusion of `getargs.h'. * src/Makefile.am (noinst_HEADERS): Adjust. * tests/calc.m4 (yyin): Be initialized in main, not on the global scope. (yyerror): Returns void, not int. * doc/bison.texinfo: Formatting changes.
This commit is contained in:
@@ -24,6 +24,7 @@ AT_DATA([calc.y],
|
||||
|
||||
static int power (int base, int exponent);
|
||||
static int read_signed_integer (FILE *stream);
|
||||
static void yyerror (const char *s);
|
||||
extern void perror (const char *s);
|
||||
%}
|
||||
|
||||
@@ -54,23 +55,10 @@ exp: NUM { $$ = $1; }
|
||||
| '(' exp ')' { $$ = $2; }
|
||||
;
|
||||
%%
|
||||
FILE *yyin = stdin;
|
||||
/* The input. */
|
||||
FILE *yyin;
|
||||
|
||||
int
|
||||
main (int argn, const char **argv)
|
||||
{
|
||||
if (argn == 2)
|
||||
yyin = fopen (argv[1], "r");
|
||||
if (!stdin)
|
||||
{
|
||||
perror (argv[1]);
|
||||
exit (1);
|
||||
}
|
||||
yyparse ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
static void
|
||||
yyerror (const char *s)
|
||||
{
|
||||
fprintf (stderr, "%s\n", s);
|
||||
@@ -138,6 +126,23 @@ power (int base, int exponent)
|
||||
res *= base;
|
||||
return res;
|
||||
}
|
||||
|
||||
int
|
||||
main (int argn, const char **argv)
|
||||
{
|
||||
if (argn == 2)
|
||||
yyin = fopen (argv[1], "r");
|
||||
else
|
||||
yyin = stdin;
|
||||
|
||||
if (!stdin)
|
||||
{
|
||||
perror (argv[1]);
|
||||
exit (1);
|
||||
}
|
||||
yyparse ();
|
||||
return 0;
|
||||
}
|
||||
]])
|
||||
|
||||
# Specify the output files to avoid problems on different file systems.
|
||||
|
||||
Reference in New Issue
Block a user