17bc9cdef7
Most warnings are for functions implicitly returning int. Change most
of these functions to return void. (Traditional K&R C had no void
type, but C89 has it.)
Add prototypes to most function declarations in headers. This is
easy, because ego declares most of its extern functions, and the
comments listed most parameters. There were a few outdated or missing
declarations, and a few .c files that failed to include an .h with the
declarations.
Add prototypes to a few function definitions in .c files. Most
functions still have traditional K&R definitions. Most STATIC
functions still don't have prototypes, because they have no earlier
declaration where I would have added the prototype.
Change some prototypes in util/ego/share/alloc.h. Functions newmap()
and oldmap() handle an array of pointers to something; change the
array's type from `short **` to `void **`. Callers use casts to go
between `void **` and the correct type, like `line_p *`. Function
oldtable() takes a `short *`, not a `short **`; I added the wrong type
in 5bbbaf4
.
Make a few other changes to silence warnings. There are a few places
where clang wants extra parentheses in the code.
Edit util/ego/ra/build.lua to add the missing dependency on ra*.h; I
needed this to prevent crashes from ra.
87 lines
2.4 KiB
C
87 lines
2.4 KiB
C
/* $Id$ */
|
|
/*
|
|
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
|
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
|
*/
|
|
/* I N T E R M E D I A T E C O D E
|
|
*
|
|
* L O O K - U P R O U T I N E S
|
|
*/
|
|
|
|
/* During Intermediate Code generation data label names ('symbols'),
|
|
* procedure names and instruction labels (numbers) are translated
|
|
* to resp. a data block pointer, a proc pointer and a label identifier.
|
|
* We use three hash tables for this purpose (symhash, prochash, numhash).
|
|
* Every name/number is hashed to an index in a specific table. A table
|
|
* entry contains a list of structs (sym, prc, num), each one representing
|
|
* a 'synonym'. (Synonyms are names/numbers having the same hash value).
|
|
*/
|
|
|
|
|
|
/* status passed as argument to look_up routines:
|
|
* resp. used occurrence, defining occurrence, occurrence in
|
|
* a MES ms_ext pseudo.
|
|
*/
|
|
|
|
#define OCCURRING 0
|
|
#define DEFINING 1
|
|
#define IMPORTING 2
|
|
|
|
#define NSYMHASH 127
|
|
#define NPROCHASH 127
|
|
#define NNUMHASH 37
|
|
|
|
extern sym_p symhash[];
|
|
extern prc_p prochash[];
|
|
extern num_p numhash[];
|
|
|
|
lab_id instr_lab(short number); /*
|
|
* Maps EM labels to sequential
|
|
* integers.
|
|
*/
|
|
dblock_p symlookup(const char *ident, int status);
|
|
/*
|
|
* Look up the data block with
|
|
* the given name.
|
|
*/
|
|
dblock_p getsym(int status); /*
|
|
* Read and look up a symbol.
|
|
* If this is the first occurrence
|
|
* of it, then make it external
|
|
* (if status=OCCURRING) or
|
|
* internal (if DEFINING).
|
|
*/
|
|
proc_p getproc(int status); /*
|
|
* Same as getsym, but for procedure
|
|
* names.
|
|
*/
|
|
proc_p proclookup(const char *ident, int status);
|
|
/*
|
|
* Find (in the hashtable) the
|
|
* procedure with the given name.
|
|
*/
|
|
void cleaninstrlabs(void); /*
|
|
* Forget about all instruction labels.
|
|
*/
|
|
void dump_procnames(prc_p hash[], int n, FILE *f);
|
|
/*
|
|
* Save the names of the procedures
|
|
* in file f; hash is the hashtable
|
|
* used and n is its length.
|
|
*/
|
|
void cleanprocs(prc_p hash[], int n, int mask);
|
|
/*
|
|
* Make the names of all procedures
|
|
* for which p_flags1&mask = 0 invisible
|
|
*/
|
|
void dump_dblocknames(sym_p hash[], int n, FILE *f);
|
|
/*
|
|
* Save the names of the EM data
|
|
* blocks in FILE f.
|
|
*/
|
|
void cleandblocks(sym_p hash[], int n, int mask);
|
|
/*
|
|
* Make the names of all data blocks
|
|
* for which d_flags1&mask = 0 invisible
|
|
*/
|