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,8 +8,10 @@
* maintains the the lists of hashed patterns * maintains the the lists of hashed patterns
* Functions : addtohashtable() and printhashtable() * Functions : addtohashtable() and printhashtable()
*/ */
# include <stdio.h>
# include "misc.h" #include <stdlib.h>
#include <stdio.h>
#include "misc.h"
struct hlist { /* linear list of pattern numbers */ struct hlist { /* linear list of pattern numbers */
int h_patno; int h_patno;
@ -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,7 +8,9 @@
* 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 <stdio.h>
#include <stdlib.h>
#include <stdio.h>
extern int lineno, newline; extern int lineno, newline;

View file

@ -9,10 +9,12 @@
* 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 <stdio.h>
# include <ctype.h> #include <stdlib.h>
# include "misc.h" #include <stdio.h>
# include "symtab.h" #include <ctype.h>
#include "misc.h"
#include "symtab.h"
struct pattern { struct pattern {
char *p_constraint; /* constraint of this pattern */ char *p_constraint; /* constraint of this pattern */
@ -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,7 +8,10 @@
* 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 "symtab.h"
#include <stdlib.h>
#include <string.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,16 +15,16 @@
%start LLparse, optim_description; %start LLparse, optim_description;
{ {
# include <stdio.h> #include <stdlib.h>
# include "token.h" #include <stdio.h>
# include "symtab.h" #include <string.h>
# include "misc.h" #include "token.h"
#include "symtab.h"
#include "misc.h"
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 */