1987-03-09 19:15:41 +00:00
|
|
|
/*
|
|
|
|
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
|
|
|
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
|
|
|
*/
|
1985-01-08 09:59:28 +00:00
|
|
|
#ifndef NORCSID
|
2019-05-10 17:17:24 +00:00
|
|
|
static char rcsid[] = "$Id$";
|
1985-01-08 09:59:28 +00:00
|
|
|
#endif
|
|
|
|
|
2006-07-18 17:18:42 +00:00
|
|
|
#include <stdlib.h>
|
1985-01-08 09:59:28 +00:00
|
|
|
#include <stdio.h>
|
2019-05-10 17:17:24 +00:00
|
|
|
#include "param.h"
|
|
|
|
#include "hall.h"
|
|
|
|
#include "expr.h"
|
2013-05-10 11:04:21 +00:00
|
|
|
#include "extern.h"
|
Cut down some clang warnings
Edit C code to reduce warnings from clang. Most warnings are for
implicit declarations of functions, but some warnings want me to add
parentheses or curly braces, or to cast arguments for printf().
Make a few other changes, like declaring float_cst() in h/con_float to
be static, and using C99 bool in ego/ra/makeitems.c and
ego/share/makecldef.c. Such changes don't silence warnings; I make
such changes while I silence warnings in the same file. In
float_cst(), rename parameter `str` to `float_str`, so it doesn't
share a name with the global variable `str`.
Remove `const` from `newmodule(const char *)` in mach/proto/as to
silence a warning. I wrongly added the `const` in d347207.
For warnings about implicit declarations of functions, the fix is to
declare the function before calling it. For example, my OpenBSD
system needs <sys/wait.h> to declare wait().
In util/int, add "whatever.h" to declare more functions. Remove old
declarations from "mem.h", to prefer the newer declarations of the
same functions in "data.h" and "stack.h".
2019-10-23 20:06:36 +00:00
|
|
|
#include "lookup.h"
|
1985-01-08 09:59:28 +00:00
|
|
|
|
|
|
|
char *filename;
|
|
|
|
|
2019-05-10 17:17:24 +00:00
|
|
|
int main(int argc, char **argv)
|
|
|
|
{
|
1985-01-08 09:59:28 +00:00
|
|
|
extern int nerrors;
|
|
|
|
extern int code_in_c;
|
|
|
|
extern int tabledebug;
|
|
|
|
extern int verbose;
|
|
|
|
|
2019-05-10 17:17:24 +00:00
|
|
|
while (argc > 1 && argv[1][0] == '-')
|
|
|
|
{
|
|
|
|
switch (argv[1][1])
|
|
|
|
{
|
|
|
|
case 'c':
|
|
|
|
code_in_c = 0;
|
|
|
|
break;
|
|
|
|
case 'd':
|
|
|
|
tabledebug++;
|
|
|
|
break;
|
|
|
|
case 'v':
|
|
|
|
verbose++;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
error("Unknown flag -%c", argv[1][1]);
|
1985-01-08 09:59:28 +00:00
|
|
|
}
|
2019-05-10 17:17:24 +00:00
|
|
|
argc--;
|
|
|
|
argv++;
|
1985-01-08 09:59:28 +00:00
|
|
|
}
|
2019-05-10 17:17:24 +00:00
|
|
|
if (argc == 2)
|
|
|
|
{
|
|
|
|
if (freopen(argv[1], "r", stdin) == NULL)
|
|
|
|
{
|
|
|
|
error("Can't open %s", argv[1]);
|
1985-01-08 09:59:28 +00:00
|
|
|
exit(-1);
|
|
|
|
}
|
|
|
|
filename = argv[1];
|
1987-01-12 14:38:45 +00:00
|
|
|
}
|
2019-05-10 17:17:24 +00:00
|
|
|
else if (argc == 1)
|
|
|
|
{
|
1987-01-12 14:38:45 +00:00
|
|
|
filename = "";
|
2019-05-10 17:17:24 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
error("Usage: %s [-c] [-d] [-v] [table]", argv[0]);
|
1985-01-08 09:59:28 +00:00
|
|
|
initemhash();
|
|
|
|
enterkeyw();
|
|
|
|
initnodes();
|
|
|
|
initio();
|
|
|
|
yyparse();
|
2019-05-10 17:17:24 +00:00
|
|
|
if (nerrors == 0)
|
|
|
|
{
|
1985-01-08 09:59:28 +00:00
|
|
|
finishio();
|
|
|
|
statistics();
|
|
|
|
if (verbose)
|
|
|
|
hallverbose();
|
2019-05-10 17:17:24 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
1985-01-08 09:59:28 +00:00
|
|
|
errorexit();
|
|
|
|
}
|
2019-05-10 17:17:24 +00:00
|
|
|
exit(nerrors == 0 ? 0 : -1);
|
1985-01-08 09:59:28 +00:00
|
|
|
}
|