2 * C compiler-- first pass header
11 * This parameter is the _only_ one which affects the recognized length
12 * of symbols. Symbol names are dynamically allocated and null terminated
13 * now, the define below is the 'cutoff' or maximum length to permit.
15 * NOTE: there are _exactly_ 4 references to this in all of c0. There are
16 * _NO_ references to it in c1. Just make sure that the value is less than
17 * 79 and c1 will be oblivious to the length of a symbol name.
19 * NOTE: The optimizer (c2) needs to be updated if the size of a symbol
20 * changes. See the file c2.h
23 #define MAXCPS 32 /* # chars per symbol */
25 #define MAXINT 077777 /* Largest positive short integer */
26 #define MAXUINT 0177777 /* largest unsigned integer */
27 #define HSHSIZ 300 /* # entries in hash table for names */
28 #define CMSIZ 40 /* size of expression stack */
29 #define SSIZE 40 /* size of other expression stack */
30 #define SWSIZ 300 /* size of switch table */
31 #define NMEMS 128 /* Number of members in a structure */
32 #define NBPW 16 /* bits per word, object machine */
33 #define NBPC 8 /* bits per character, object machine */
34 #define NCPW 2 /* chars per word, object machine */
35 #define LNCPW 2 /* chars per word, compiler's machine */
36 #define LNBPW 16 /* bits per word, compiler's machine */
38 #define STAUTO (-6) offset of first auto variable */
40 #define STARG 4 /* offset of first argument */
41 #define DCLSLOP 512 /* Amount trees lie above declaration stuff */
47 #define MAXPATHLEN 1024
52 * # bytes in primitive types
61 extern char cvtab[4][4];
62 extern char filename[MAXPATHLEN]; /* Nick */
65 extern char symbuf[MAXCPS+2];
66 extern struct nmlist *hshtab[HSHSIZ];
67 extern int kwhash[(HSHSIZ+LNBPW-1)/LNBPW];
68 extern struct node **cp;
70 extern struct swtab swtab[SWSIZ];
72 extern struct swtab *swp;
77 extern unsigned autolen; /* make these int if necessary */
78 extern unsigned maxauto; /* ... will only cause trouble rarely */
84 extern char *treebase;
87 extern struct nmlist *defsym;
88 extern struct nmlist *funcsym;
91 extern struct nmlist *csym;
97 extern struct nmlist *paraml;
98 extern struct nmlist *parame;
105 extern char sbuf[BUFSIZ];
110 extern struct locnnode funcblk;
111 extern char cvntab[];
112 extern char numbuf[64];
113 extern struct nmlist **memlist;
114 extern union str *sparent;
116 extern struct nmlist structhole;
177 /*#define FFIELD 020*/
181 extern struct kwtab {
188 #define __P(args) args
195 int main __P((int argc, char *argv[]));
196 int lookup __P((void));
197 int findkw __P((void));
198 int symbol __P((void));
199 int getnum __P((void));
200 int subseq __P((int c, int a, int b));
201 void putstr __P((int lab, register int max));
202 void cntstr __P((void));
203 int getcc __P((void));
204 int mapch __P((int ac));
205 struct node *tree __P((/*int eflag*/));
206 struct tnode *xprtype __P((void));
207 char *copnum __P((int len));
210 void build __P((int op));
211 void structident __P((register struct node *p1, register struct nnode *p2));
212 struct node *convert __P((struct node *p, int t, int cvn, int len));
213 void setype __P((register struct node *p, register int t, register struct node *newp));
214 struct node *chkfun __P((register struct node *p));
215 struct node *disarray __P((register struct node *p));
216 void chkw __P((struct node *p, int okt));
217 int lintyp __P((int t));
218 void werror0 __P((char *s, ...));
219 void error0 __P((char *s, ...));
220 struct tnode *block __P((int op, int t, int *subs, union str *str, struct node *p1, struct node *p2));
221 struct nnode *nblock __P((register struct nmlist *ds));
222 struct cnode *cblock __P((_INT value));
223 struct lnode *lblock __P((_LONG lvalue));
224 struct fnode *fblock __P((int value, _DOUBLE fvalue));
225 char *Tblock __P((int n));
226 char *starttree __P((void));
227 void endtree __P((char *tp));
228 char *Dblock __P((int n));
229 void chklval __P((register struct node *p));
230 int fold __P((int op, register struct node *p1, struct node *p2));
231 int conexp __P((void));
232 void assignop __P((int op, register struct node *p1, register struct node *p2));
233 struct nmlist *gentemp __P((int type));
236 void extdef __P((void));
237 void cfunc __P((void));
238 int cinit __P((struct nmlist *anp, int flex, int sclass));
239 void strinit __P((struct nmlist *np, int sclass));
240 void setinit __P((register struct nmlist *np));
241 void statement __P((void));
242 int forstmt __P((void));
243 struct node *pexpr __P((/*int eflag*/));
244 void pswitch0 __P((void));
245 void funchead __P((void));
246 void blockhead __P((void));
247 void blkend __P((void));
248 void nameconflict __P((register struct nmlist *ocs, register struct nmlist *cs));
249 void prste __P((struct nmlist *cs));
250 void errflush __P((int ao));
253 int declist __P((int sclass));
254 /*int*/struct type *getkeywords __P((int *scptr/*, struct nmlist *tptr*/));
255 /*union str*/struct stype *strdec __P((int mosf, int kind));
256 int declare __P((int askw, struct /*nmlist*/type *tptr, int offset));
257 void XXXdumptype __P((struct type *dtype));
258 int XXXoldtype __P((struct type *dtype, struct tdim *dimp, struct SS **strp));
259 int decl1 __P((int askw, struct /*nmlist*/type *atptr, int offset, struct nmlist *absname));
260 struct nmlist *pushdecl __P((register struct nmlist *sp));
261 /*int getype __P((register struct tdim *dimp, struct nmlist *absname));*/
262 struct rtype *getype __P((struct rtype *tail, int anonok));
263 void typov __P((void));
264 int align __P((/*int*/struct type *type, int offset, int aflen));
265 void decsyn __P((int o));
266 void redec __P((void));
267 int goodreg __P((struct nmlist *hp));
270 int decref0 __P((register int t));
271 int incref0 __P((register int t));
272 void cbranch0 __P((struct node *t, int lbl, int cond));
273 void rcexpr0 __P((register struct node *tp));
274 void treeout __P((register struct node *tp, int isstruct));
275 void branch0 __P((int lab));
276 void label0 __P((int l));
277 int XXXlength __P((struct node *cs));
278 int plength __P((register struct node *p));
279 int length __P((struct /*node*/type *cs));
280 int rlength __P((struct /*node*/type *cs));
281 int simplegoto __P((void));
282 int nextchar __P((void));
283 int spnextchar __P((void));
284 void chconbrk __P((int l));
285 void dogoto __P((void));
286 void doret __P((void));
287 void outcode __P((char *s, ...));
288 unsigned int hash __P((register char *sp));