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

This commit is contained in:
dtrg 2006-07-18 17:10:29 +00:00
parent 8ea67498ed
commit 4c0a0e6119
48 changed files with 80 additions and 66 deletions

View file

@ -7,6 +7,7 @@
* V1.0, 08-Mar-89 AJM
*/
#include <stdlib.h>
#include <stdio.h>
#include "out.h"
#include "arm.h"

View file

@ -9,6 +9,7 @@
* It uses ~em/modules/lib/libobject.a.
*/
#include <stdlib.h>
#include <stdio.h>
struct xexec {
@ -351,7 +352,6 @@ emit_symtab()
char *chars, *xname;
struct outname *names;
register char *xptr;
extern char *malloc();
long off = OFF_CHAR(outhead);
register char *p;
register struct outname *np;

View file

@ -13,6 +13,7 @@
#include <stdio.h>
#include <out.h>
#include <assert.h>
#include <stdlib.h>
struct outhead outhead;
struct outsect outsect[S_MAX];
@ -163,7 +164,6 @@ main(argc, argv)
*/
emits(section) struct outsect *section ; {
char *p;
char *calloc(), *malloc();
long sz = section->os_flen;
rd_outsect(section - outsect);

View file

@ -78,11 +78,15 @@ separate linker only possible if relocation info produced
/* ========== Machine independent type declarations ========== */
#ifdef _include
_include <stdlib.h>
_include <stdio.h>
_include <string.h>
_include <ctype.h>
_include <signal.h>
#else
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <signal.h>
#endif

View file

@ -116,14 +116,6 @@ extern valu_t load();
extern FILE *ffcreat();
extern FILE *fftemp();
/* some library functions used */
extern char *mktemp();
extern char *malloc();
extern char *realloc();
extern char *calloc();
extern char *getenv();
extern char *strncpy();
/* ========== Machine dependent C declarations ========== */
#include "mach1.c"

View file

@ -20,7 +20,7 @@ extern YYSTYPE yylval;
/* ========== Machine independent C routines ========== */
stop() {
void stop() {
#if DEBUG < 2
unlink(temppath);
#ifdef LISTING

View file

@ -2,6 +2,9 @@
static char rcsid[] = "$Id$";
#endif
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "assert.h"
#include "param.h"
#include "tables.h"

View file

@ -2,6 +2,8 @@
static char rcsid[] = "$Id$";
#endif
#include <stdlib.h>
#include <string.h>
#include "param.h"
#include "tables.h"
#include "types.h"

View file

@ -2,6 +2,7 @@
static char rcsid[] = "$Id$";
#endif
#include <stdlib.h>
#include "assert.h"
#include "param.h"
#include "tables.h"
@ -29,7 +30,6 @@ static char rcsid[] = "$Id$";
char *stab[MAXSTAB];
int nstab=0;
string malloc();
string myalloc(size) {
register string p;

View file

@ -2,6 +2,7 @@
static char rcsid[] = "$Id$";
#endif
#include <stdlib.h>
#include "assert.h"
#include <stdio.h>
#include "param.h"

View file

@ -2,6 +2,9 @@
static char rcsid[] = "$Id$";
#endif
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "assert.h"
#include "param.h"
#include "tables.h"

View file

@ -2,6 +2,8 @@
static char rcsid[] = "$Id$";
#endif
#include <stdlib.h>
#include <string.h>
#include "param.h"
#include "tables.h"
#include "types.h"
@ -15,7 +17,6 @@ static char rcsid[] = "$Id$";
*/
extern string myalloc();
extern char *strcpy();
glosym_p glolist= (glosym_p) 0;

View file

@ -2,6 +2,7 @@
static char rcsid[] = "$Id$";
#endif
#include <stdlib.h>
#include "assert.h"
#include "param.h"
#include "tables.h"
@ -29,7 +30,6 @@ static char rcsid[] = "$Id$";
char *stab[MAXSTAB];
int nstab=0;
string malloc();
string myalloc(size) {
register string p;

View file

@ -2,8 +2,9 @@
static char rcsid[] = "$Id$";
#endif
#include "assert.h"
#include <stdlib.h>
#include <stdio.h>
#include "assert.h"
#include "param.h"
#include "tables.h"
#include "types.h"

View file

@ -13,6 +13,7 @@
#include <stdio.h>
#include <out.h>
#include <assert.h>
#include <stdlib.h>
long lseek();
@ -270,7 +271,6 @@ writef(addr,sz,cnt)
*/
emits(section) struct outsect *section ; {
char *p;
char *calloc(), *malloc();
long sz = section->os_flen;
rd_outsect(section - outsect);
@ -484,7 +484,6 @@ emit_symtab()
register struct outname *A;
struct sym *MACHnames;
register struct sym *M;
extern char *malloc(), *calloc();
char *chars;
long offX = OFF_CHAR(outhead) - 4;

View file

@ -7,6 +7,7 @@
indicated by the parameters, and then give a core dump
*/
#include <string.h>
#include <system.h>
static

View file

@ -8,6 +8,9 @@
/* I/O part of em_code module.
Also contains C_open, C_close
*/
#include <stdlib.h>
#include <stdio.h>
#include <alloc.h>
#include <em_arith.h>
#include "insert.h"

View file

@ -4,6 +4,7 @@
*/
/* $Id$ */
#include <string.h>
#include <system.h>
#include "print.h"

View file

@ -86,12 +86,12 @@ EM_doinstr(p)
if (! checkarg(&(p->em_arg), cst_ptyp)) return;
}
else {
#include "C_mnem_narg"
#include "C_mnem_narg.h"
return;
}
break;
}
#include "C_mnem"
#include "C_mnem.h"
}
PRIVATE void

View file

@ -17,6 +17,8 @@
some routines from the system module. and the em_code module
*/
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
#include <alloc.h>
#include <system.h>
@ -35,8 +37,6 @@
#define ungetbyte(uch) ((uch) >= 0 && (*--_ich = (uch)))
#define init_input() (_fill(), _ich--)
#define EOF -1
static File *fd;
static char *_ich;

View file

@ -9,6 +9,7 @@
*/
#include <ctype.h>
#include <string.h>
/* #define XXX_YYY /* only for early debugging */

View file

@ -4,7 +4,7 @@
*/
/* $Id$ */
#include <system.h>
#include "system.h"
int
sys_access(path, mode)

View file

@ -4,15 +4,13 @@
*/
/* $Id$ */
#include <system.h>
char *sbrk();
#include "system.h"
#include <unistd.h>
char *
sys_break(incr)
int incr;
{
char *sbrk();
register char *brk = sbrk(incr);
if (brk == (char *) 0 || brk == (char *)-1)

View file

@ -4,7 +4,7 @@
*/
/* $Id$ */
#include <system.h>
#include "system.h"
int
sys_chmode(path, mode)

View file

@ -4,7 +4,7 @@
*/
/* $Id$ */
#include <system.h>
#include "system.h"
void
sys_close(fp)

View file

@ -4,7 +4,7 @@
*/
/* $Id$ */
#include <system.h>
#include "system.h"
extern File *_get_entry();

View file

@ -6,7 +6,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <system.h>
#include "system.h"
long
sys_filesize(path)

View file

@ -4,7 +4,7 @@
*/
/* $Id$ */
#include <system.h>
#include "system.h"
int
sys_lock(path)

View file

@ -6,8 +6,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <system.h>
#include "system.h"
long
sys_modtime(path)

View file

@ -4,7 +4,7 @@
*/
/* $Id$ */
#include <system.h>
#include "system.h"
extern File *_get_entry();

View file

@ -4,7 +4,7 @@
*/
/* $Id$ */
#include <system.h>
#include "system.h"
int
sys_read(fp, bufptr, bufsiz, pnbytes)

View file

@ -4,7 +4,7 @@
*/
/* $Id$ */
#include <system.h>
#include "system.h"
int
sys_remove(path)

View file

@ -4,7 +4,7 @@
*/
/* $Id$ */
#include <system.h>
#include "system.h"
int
sys_rename(path1, path2)

View file

@ -4,7 +4,7 @@
*/
/* $Id$ */
#include <system.h>
#include "system.h"
long lseek();

View file

@ -5,7 +5,7 @@
/* $Id$ */
#include <stdlib.h>
#include <system.h>
#include "system.h"
void
sys_stop(how)

View file

@ -4,7 +4,7 @@
*/
/* RCS: $Id$ */
#include <system.h>
#include "system.h"
File _sys_ftab[SYS_NOPEN] = {
{ 0, OP_READ},

View file

@ -62,6 +62,4 @@ _PROTOTYPE(long sys_modtime, (char *));
/* return value for sys_break */
#define ILL_BREAK ((char *)0)
/* system's idea of block */
#define BUFSIZ 1024
#endif /* __SYSTEM_INCLUDED__ */

View file

@ -4,7 +4,7 @@
*/
/* $Id$ */
#include <system.h>
#include "system.h"
long time();

View file

@ -4,7 +4,7 @@
*/
/* $Id$ */
#include <system.h>
#include "system.h"
int
sys_unlock(path)

View file

@ -4,7 +4,7 @@
*/
/* $Id$ */
#include <system.h>
#include "system.h"
int
sys_write(fp, bufptr, nbytes)

View file

@ -25,6 +25,9 @@ static char RcsId[] = "$Id$";
#endif
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <signal.h>
@ -38,7 +41,6 @@ struct ranlib *tab;
unsigned int tnum = 0;
char *tstrtab;
unsigned int tssiz = 0;
char *malloc(), *realloc(), *strcpy(), *strncpy();
long time();
unsigned int tabsz, strtabsz;
#else

View file

@ -1,3 +1,4 @@
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include "states.h"

View file

@ -1,3 +1,6 @@
#include <stdlib.h>
#include <string.h>
#if __STDC__
#include <stdarg.h>
extern out(char *, ...);

View file

@ -38,6 +38,8 @@
*/
{
#include <stdlib.h>
#include <string.h>
#include "decl.h"
extern int lineno, yyleng;

View file

@ -11,7 +11,9 @@ static char rcsid[]="$Id$";
* Author: Hans van Staveren
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <em_spec.h>
#include <em_flag.h>
@ -37,8 +39,8 @@ static char rcsid[]="$Id$";
inst_t yy_instance;
}
%type <yy_list1> list1,structlistel
%type <yy_list2> structlist,structdecl
%type <yy_list1> list1 structlistel
%type <yy_list2> structlist structdecl
%type <yy_expr> expr optexpr
%type <yy_cost> optcost cost optcommacost
%type <yy_int> optboolexpr optnocoerc mnem emargno tokargno optprop
@ -48,8 +50,8 @@ static char rcsid[]="$Id$";
%type <yy_instance> tokeninstance
%type <yy_string> optformat
%token <yy_string> IDENT TYPENAME
%token <yy_ident> RIDENT,PIDENT,TIDENT,EIDENT
%token <yy_string> LSTRING,STRING
%token <yy_ident> RIDENT PIDENT TIDENT EIDENT
%token <yy_string> LSTRING STRING
%token <yy_int> NUMBER
%token <yy_intp> CIDENT
%token REGISTERHEAD TOKENHEAD EXPRESSIONHEAD CODEHEAD MOVEHEAD TESTHEAD STACKHEAD
@ -63,12 +65,12 @@ static char rcsid[]="$Id$";
%left OR2
%left AND2
%left CMPEQ,CMPNE
%left CMPLT,CMPLE,CMPGT,CMPGE
%left RSHIFT,LSHIFT
%left '+','-'
%left '*','/','%'
%nonassoc NOT,COMP,UMINUS
%left CMPEQ CMPNE
%left CMPLT CMPLE CMPGT CMPGE
%left RSHIFT LSHIFT
%left '+' '-'
%left '*' '/' '%'
%nonassoc NOT COMP UMINUS
%nonassoc '$'
%%
machinespec

View file

@ -1,20 +1,14 @@
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
#include <ctype.h>
#include <string.h>
#include <em_spec.h>
#include <em_flag.h>
#include <em_reg.h>
#include "booth.h"
extern char *strncpy(), *strcpy();
extern char *malloc();
#ifndef __STDC__
extern char *sprintf();
#else
/* sprintf should be declared in stdio.h, as returning an int */
#endif
char * myalloc(n) {
register char *p;

View file

@ -9,7 +9,9 @@
Many mods by Ceriel Jacobs
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#ifndef NORCSID
static char *RcsId = "$Id$";
@ -28,8 +30,6 @@ char *ProgCall; /* callname of this program */
int TabSize = 128; /* default size of generated table */
char *InitialValue; /* initial value of all table entries */
extern char *malloc(), *strcpy();
main(argc, argv)
char *argv[];
{

View file

@ -5,6 +5,8 @@
*/
/* PREPROCESSOR: MACRO-TEXT REPLACEMENT ROUTINES */
#include <stdlib.h>
#include <string.h>
#include "debug.h" /* UF */
#include "pathlength.h" /* UF */
#include "textsize.h" /* UF */