1994-06-24 14:02:31 +00:00
|
|
|
/* $Id$ */
|
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-04-12 16:56:43 +00:00
|
|
|
/* @(#)comm1.h 1.5 */
|
|
|
|
/*
|
|
|
|
* variable declarations
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef extern
|
|
|
|
#define INIT(x) = x
|
|
|
|
#else
|
|
|
|
#define INIT(x) /* empty */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
extern short pass INIT(PASS_1);
|
|
|
|
/* PASS 1, 2 or 3 */
|
|
|
|
extern short peekc; /* push back symbol (PASS_1) */
|
|
|
|
extern short unresolved; /* number of unresolved references */
|
1988-06-13 15:28:19 +00:00
|
|
|
extern long lineno; /* input line number */
|
1985-04-12 16:56:43 +00:00
|
|
|
extern short hllino; /* high-level language line number */
|
|
|
|
extern short nerrors; /* terminate at end of pass if set */
|
|
|
|
extern short sflag INIT(SYM_DEF);
|
|
|
|
/* -s option (symbol table info) */
|
|
|
|
extern char *progname; /* for error messages */
|
|
|
|
extern char *modulename; /* for error messages */
|
1986-12-01 15:41:29 +00:00
|
|
|
extern common_t *commons; /* header of commons list */
|
1985-04-12 16:56:43 +00:00
|
|
|
|
|
|
|
#ifdef ASLD
|
|
|
|
extern short archmode; /* scanning archives */
|
|
|
|
extern long archsize; /* size of individual archive entries */
|
|
|
|
#else
|
|
|
|
extern short uflag; /* if 1 make undefineds extern */
|
|
|
|
/* symbol table index for last S_UND */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef LISTING
|
|
|
|
extern short dflag; /* -d option (list mode) */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef ASLD
|
|
|
|
#ifdef RELOCATION
|
|
|
|
extern short rflag; /* -r option (relocation info) */
|
1991-12-17 15:05:43 +00:00
|
|
|
#endif /* RELOCATION */
|
1985-04-12 16:56:43 +00:00
|
|
|
#else
|
|
|
|
#define rflag 1
|
|
|
|
extern valu_t relonami;
|
1991-12-17 15:05:43 +00:00
|
|
|
#endif /* ASLD */
|
1985-04-12 16:56:43 +00:00
|
|
|
|
|
|
|
#ifdef THREE_PASS
|
|
|
|
extern short bflag; /* -b option (no optimizations) */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
extern char *aoutpath INIT("a.out");
|
|
|
|
|
|
|
|
extern FILE *input;
|
|
|
|
extern FILE *tempfile;
|
|
|
|
|
1990-08-01 14:30:45 +00:00
|
|
|
extern char *stringbuf; /* contains last string value */
|
|
|
|
extern int stringlen; /* contains length of last string value */
|
1985-04-12 16:56:43 +00:00
|
|
|
|
|
|
|
extern sect_t sect[SECTMAX];
|
|
|
|
|
|
|
|
/*
|
|
|
|
* specials for the location counter
|
|
|
|
*/
|
|
|
|
extern sect_t *DOTSCT; /* §[DOTTYP-S_MIN] or NULL */
|
1991-12-16 15:24:24 +00:00
|
|
|
extern ADDR_T DOTVAL; /* DOTSCT->s_size + DOTSCT->s_base */
|
1985-04-12 16:56:43 +00:00
|
|
|
extern short DOTTYP; /* S_MIN..S_MAX or S_UND */
|
|
|
|
|
1991-12-16 15:24:24 +00:00
|
|
|
extern unsigned short nname; /* Counts name table index in PASS_3 */
|
1986-12-01 15:41:29 +00:00
|
|
|
|
1985-04-12 16:56:43 +00:00
|
|
|
extern item_t *hashtab[H_TOTAL];
|
|
|
|
extern short hashindex; /* see item_search() */
|
|
|
|
|
|
|
|
extern item_t *fb_ptr[4*FB_SIZE];
|
|
|
|
|
|
|
|
#ifdef THREE_PASS
|
1988-06-16 13:24:10 +00:00
|
|
|
#define BITCHUNK (8 * MEMINCR)
|
|
|
|
extern int nbits;
|
|
|
|
extern int bitindex; /* bitindex * MEMINCR * 8 + nbits gives
|
|
|
|
number of decisions so far
|
|
|
|
*/
|
1985-04-12 16:56:43 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef LISTING
|
|
|
|
extern short listmode; /* -d option for current pass */
|
|
|
|
extern short listtemp; /* listmode if .list seen */
|
|
|
|
extern short listflag; /* copied from listtemp at '\n' */
|
|
|
|
extern short listcolm; /* column on output */
|
|
|
|
extern short listeoln INIT(1);
|
|
|
|
/* set by endline, tested by emit1 */
|
|
|
|
extern FILE *listfile; /* copy of source text */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef extern
|
|
|
|
extern item_t keytab[];
|
|
|
|
extern struct outhead outhead;
|
|
|
|
#endif
|
|
|
|
|
1993-02-08 13:01:30 +00:00
|
|
|
extern int curr_token;
|
|
|
|
|
1985-04-12 16:56:43 +00:00
|
|
|
/* forward function declarations */
|
2017-11-11 04:30:46 +00:00
|
|
|
/* comm2.y */
|
2017-11-11 21:09:05 +00:00
|
|
|
int yyparse(void);
|
2017-11-11 04:30:46 +00:00
|
|
|
/* comm4.c */
|
|
|
|
void stop(void);
|
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
|
|
|
void newmodule(char *);
|
2017-01-17 21:41:29 +00:00
|
|
|
/* comm5.c */
|
|
|
|
int yylex(void);
|
|
|
|
void putval(int);
|
|
|
|
int getval(int);
|
|
|
|
int nextchar(void);
|
1991-01-11 14:20:59 +00:00
|
|
|
#ifdef ASLD
|
2017-01-17 21:41:29 +00:00
|
|
|
char *readident(int);
|
1991-01-11 14:20:59 +00:00
|
|
|
#endif
|
2017-11-11 04:30:46 +00:00
|
|
|
int hash(const char *);
|
|
|
|
item_t *item_search(const char *);
|
2017-01-17 21:41:29 +00:00
|
|
|
void item_insert(item_t *, int);
|
|
|
|
item_t *item_alloc(int);
|
|
|
|
item_t *fb_alloc(int);
|
|
|
|
item_t *fb_shift(int);
|
2017-11-11 04:30:46 +00:00
|
|
|
/* comm6.c */
|
|
|
|
void newequate(item_t *, int);
|
|
|
|
void newident(item_t *, int);
|
|
|
|
void newlabel(item_t *);
|
|
|
|
void newsect(item_t *);
|
|
|
|
void newbase(valu_t);
|
|
|
|
void newcomm(item_t *, valu_t);
|
|
|
|
void switchsect(int);
|
|
|
|
void align(valu_t);
|
|
|
|
#ifdef RELOCATION
|
|
|
|
void newrelo(int, int);
|
|
|
|
#endif
|
|
|
|
long new_string(const char *);
|
|
|
|
void newsymb(const char *, int, int, valu_t);
|
2017-01-17 21:41:29 +00:00
|
|
|
/* comm7.c */
|
2017-11-11 04:30:46 +00:00
|
|
|
valu_t load(const item_t *);
|
|
|
|
int store(item_t *, valu_t);
|
|
|
|
char *remember(char *);
|
|
|
|
int combine(int, int, int);
|
|
|
|
#ifdef LISTING
|
|
|
|
int printx(int, valu_t);
|
|
|
|
void listline(int);
|
|
|
|
#endif
|
|
|
|
#ifdef THREE_PASS
|
|
|
|
int small(int, int);
|
|
|
|
#endif
|
|
|
|
void emit1(int);
|
|
|
|
void emit2(int);
|
|
|
|
void emit4(long);
|
|
|
|
void emitx(valu_t, int);
|
2019-08-13 15:47:44 +00:00
|
|
|
void emit8(int64_t);
|
2017-11-11 04:30:46 +00:00
|
|
|
void emitstr(int);
|
2019-08-13 15:47:44 +00:00
|
|
|
void emitf(int size, int negative);
|
2017-11-11 04:30:46 +00:00
|
|
|
void yyerror(const char *);
|
|
|
|
void nosect(void);
|
2017-01-17 21:41:29 +00:00
|
|
|
void fatal(const char *, ...);
|
|
|
|
void serror(const char *, ...);
|
|
|
|
void warning(const char *, ...);
|
2017-11-11 04:30:46 +00:00
|
|
|
void nofit(void);
|
2015-03-22 23:07:59 +00:00
|
|
|
|
1985-04-12 16:56:43 +00:00
|
|
|
/* ========== Machine dependent C declarations ========== */
|
|
|
|
|
|
|
|
#include "mach1.c"
|