Rationalised use of #includes to be more standards-compliant.

This commit is contained in:
dtrg 2006-07-22 12:28:20 +00:00
parent 744d0ca7be
commit fdcdaadcb8
6 changed files with 30 additions and 22 deletions

View file

@ -3,21 +3,24 @@
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands. * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
* See the copyright notice in the ACK home directory, in the file "Copyright". * See the copyright notice in the ACK home directory, in the file "Copyright".
*/ */
#include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h>
#include "gen.h" #include "gen.h"
#include "top.h" #include "top.h"
#include "queue.h" #include "queue.h"
/* Defined in the string module, which has no header file. FIXME. */
extern char* strindex(char *s, int c);
/* STANDARD MACHINE-INDEPENT C CODE *************/ /* STANDARD MACHINE-INDEPENT C CODE *************/
extern char *lstrip(); extern char *lstrip();
extern instr_p newinstr(); extern instr_p newinstr();
extern instr_p read_instr(); extern instr_p read_instr();
extern instr_p gen_instr(); extern instr_p gen_instr();
extern char * malloc();
extern char *strcat();
extern char *strcpy();
extern char *strncpy();
struct variable var[NRVARS+1]; struct variable var[NRVARS+1];
struct variable ANY; /* ANY symbol matching any instruction */ struct variable ANY; /* ANY symbol matching any instruction */

View file

@ -8,6 +8,8 @@
* maintains the the lists of hashed patterns * maintains the the lists of hashed patterns
* Functions : addtohashtable() and printhashtable() * Functions : addtohashtable() and printhashtable()
*/ */
#include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include "misc.h" #include "misc.h"
@ -40,7 +42,6 @@ addtohashtable(s,n) char *s; {
*/ */
unsigned hval; unsigned hval;
register struct hlist *p; register struct hlist *p;
char *malloc();
hval = hash(s); hval = hash(s);
p = (struct hlist *) malloc(sizeof *p); p = (struct hlist *) malloc(sizeof *p);

View file

@ -8,6 +8,8 @@
* Contains the main program, the error reporting routine, and a routine * Contains the main program, the error reporting routine, and a routine
* to check wether a constraint consists only of space * to check wether a constraint consists only of space
*/ */
#include <stdlib.h>
#include <stdio.h> #include <stdio.h>
extern int lineno, newline; extern int lineno, newline;

View file

@ -9,6 +9,8 @@
* it maintains a table of information about the patterns * it maintains a table of information about the patterns
* Functions : addpattern() and printpatterns() * Functions : addpattern() and printpatterns()
*/ */
#include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <ctype.h> #include <ctype.h>
#include "misc.h" #include "misc.h"
@ -37,7 +39,6 @@ addpattern(str,l,np,nr) char *str; {
* "nr" is the number of instructions in the replacement * "nr" is the number of instructions in the replacement
* Space is allocated in chunks of 50 * Space is allocated in chunks of 50
*/ */
char *malloc(), *realloc();
register struct pattern *p; register struct pattern *p;
if (!pattable) { /* No space allocated yet */ if (!pattable) { /* No space allocated yet */

View file

@ -8,6 +8,9 @@
* Contains the routine findident, which builds the symbol table and * Contains the routine findident, which builds the symbol table and
* searches identifiers * searches identifiers
*/ */
#include <stdlib.h>
#include <string.h>
#include "symtab.h" #include "symtab.h"
struct symtab *idtable, *deftable; struct symtab *idtable, *deftable;
@ -20,8 +23,6 @@ findident(s, mode, table) char *s; struct symtab **table; {
* If mode = ENTERING, a new entry will be made if s is not in the * If mode = ENTERING, a new entry will be made if s is not in the
* table yet, otherwise an error results * table yet, otherwise an error results
*/ */
char *malloc();
char *strcpy();
register struct symtab *p; register struct symtab *p;
register n; register n;

View file

@ -15,7 +15,9 @@
%start LLparse, optim_description; %start LLparse, optim_description;
{ {
#include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h>
#include "token.h" #include "token.h"
#include "symtab.h" #include "symtab.h"
#include "misc.h" #include "misc.h"
@ -23,8 +25,6 @@
char idbuf[BUFSIZ], buf[BUFSIZ]; char idbuf[BUFSIZ], buf[BUFSIZ];
int countid; /* # of variables */ int countid; /* # of variables */
int countpat; /* # of patterns */ int countpat; /* # of patterns */
char * malloc();
char * strcpy();
static int patlen; /* Maximum number of instructions in pattern */ static int patlen; /* Maximum number of instructions in pattern */
static int maxoperand; /* Maximum number of operands of instruction */ static int maxoperand; /* Maximum number of operands of instruction */
extern FILE *input; /* file descriptor of inputfile */ extern FILE *input; /* file descriptor of inputfile */