2 * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
3 * See the copyright notice in the ACK home directory, in the file "Copyright".
12 #define RCS_ASS "$Id: ass00.h,v 2.15 1994/06/24 10:15:04 ceriel Exp $"
15 * compile time options
18 #define DUMP 1 /* dump between passes */
19 /* #define TIMING 1 /* some timing measurements */
20 #define JOHAN 1 /* dump the loaded instructions */
21 #define MEMUSE 1 /* print memory usage statistics */
24 #define dump(x) /* nothing */
28 #define timing() /* nothing */
32 #define memuse() /* nothing */
35 /* Used to clear the upper byte(s) of characters.
36 Not nessecary if your C-compiler does not sign-extend char's
40 # define LC(ch) ( ((ch)<'A' | (ch)>'Z' ) ? (ch) : ((ch)-('A'-'a')))
45 #define ctrunc(val) ( (val)&0377 )
47 #define odd(n) ((n)&1) /* Boolean odd function */
49 #define lnp_cast (line_t *)
50 #define gbp_cast (glob_t *)
51 #define lbp_cast (locl_t *)
52 #define prp_cast (proc_t *)
53 #define ptp_cast (ptab_t *)
54 #define rlp_cast (relc_t *)
55 #define pst_cast (stat_t *)
56 #define chp_cast (char *)
57 #define ipp_cast (int **)
58 #define iip_cast (int *)
59 #define int_cast (int )
61 typedef struct lines line_t;
62 typedef struct loc_label locl_t;
63 typedef struct glob_label glob_t;
64 typedef struct rel relc_t;
65 typedef struct procstat stat_t;
66 typedef struct sizes siz_t;
67 typedef struct ar_hdr arch_t;
68 typedef struct procs proc_t;
69 typedef struct proctab ptab_t;
70 typedef char * area_t;
94 #define FOFFSET long /* offset into file */
97 * Global variables and definitions for EM1-assembler/loader
100 #define DEFINING 0 /* parameters for glolookup */
107 #define PRO_OCC 0 /* parameters for prolookup */
117 #define MAXSTRING 200 /* Maximum string length accepted */
118 #define LOCLABSIZE 128 /* size of local label hash table */
119 /* may not be smaller */
123 char instr_num; /* index into mnemon[] */
124 char type1; /* see below */
125 line_t *l_next; /* next in chain */
126 char *opoff; /* pointer into opchoice[] */
127 addr_u ad; /* depending on type, various pointers */
130 /* contents of type1 */
131 #define MISSING 0 /* no operand */
132 #define CONST 1 /* ad contains operand */
133 #define PROCNAME 2 /* ad contains struct procs pointer */
134 #define GLOSYM 3 /* ad contains pointer into mproc[] */
135 #define LOCSYM 4 /* ad contains pointer into locs[] */
136 #define GLOOFF 5 /* ad contains CONST and GLOSYM in ad_df */
137 #define LINES 6 /* Line number setting, only param of pseudo*/
138 #define VALLOW 7 /* value's between LOW and HIGH are x-MID */
140 #define VALHIGH 127 /* to avoid sign extension problems */
142 #define VAL1(x) ((x)-VALMID)
144 /* Used to indicate a invalid contents of opoff */
145 #define NO_OFF ((char *)-1)
148 locl_t *l_chain; /* The next label with same low order bits */
149 char l_hinum; /* high bits of number of label */
150 char l_defined; /* see below */
151 int l_min,l_max; /* boundaries of value */
154 /* The structure containing procedure pertinent data */
155 /* Used for environment stacking for nested PRO's */
158 line_t *s_fline; /* points to first line of procedure */
159 locl_t (*s_locl)[1]; /* pointer to local labels */
160 proc_t *s_curpro; /* identifies current procedure */
161 relc_t *s_fdata; /* last datareloc before procedure */
162 stat_t *s_prevstat; /* backward chain of nested procedures */
165 /* contents of l_defined */
166 #define EMPTY 0 /* Empty slot */
167 #define NO 1 /* not defined yet */
168 #define YES 2 /* defined */
169 #define SEEN 3 /* intermediate state */
170 #define NOTPRESENT 4 /* Undefined and error message given */
174 char g_status; /* see below */
176 cons_t g_addr; /* value if status&DEF */
177 struct glob_label *g_gp; /* ref. to xglobs */
181 #define glostring(gl) ((gl)->g_name)
183 /* contents of g_status */
184 #define DEF 01 /* defined */
185 #define OCC 02 /* used */
186 #define EXT 04 /* external */
188 struct rel { /* for relocation tables */
189 relc_t *r_next; /* chain */
190 FOFFSET r_off; /* offset in text/data of word to relocate */
191 rel_u r_val; /* constant or pointer to global symbol */
192 int r_typ; /* different use in text or data */
196 * When used with textrelocation r_typ contains the flag bits as defined
197 * in ip_spec.h together with the RELMNS bit if r_val contains an integer
200 #define RELMNS 020000 /* indicates integer i.s.o. glob */
202 /* Contents of r_typ when used with data relocation */
209 /* modes of data output */
221 /* name of procedure to be called first */
222 #define MAIN "_m_a_i_n"
224 /* headers of datablocks written */
235 #define NDEFAULT 4 /* number of different sizes available */
237 int n_mlab; /* # of global labels per module */
238 int n_glab; /* # of extern global labels */
239 int n_mproc; /* # of local procs per module */
240 int n_xproc; /* # of external procs */
241 int n_proc; /* total # of procedures */
244 struct procs { /* format of mprocs[] and xprocs[] */
246 char p_status; /* same bits as g_status except REL */
247 int p_num; /* unique procedure descriptor */
251 cons_t pr_loc; /* number of bytes locals */
252 cons_t pr_off; /* distance from pb */