BSD 3 development
[unix-history] / usr / src / cmd / mip / xdefs.c
CommitLineData
72d5e2a4
BJ
1# include "mfile1"
2
3/* communication between lexical routines */
4
5char ftitle[100] = ""; /* title of the file */
6char ititle[100] = ""; /* title of initial file */
7int lineno; /* line number of the input file */
8
9CONSZ lastcon; /* the last constant read by the lexical analyzer */
10double dcon; /* the last double read by the lexical analyzer */
11
12
13/* symbol table maintainence */
14
15struct symtab stab[SYMTSZ+1]; /* one extra slot for scratch */
16
17int curftn; /* "current" function */
18int ftnno; /* "current" function number */
19
20int curclass, /* current storage class */
21 instruct, /* "in structure" flag */
22 stwart, /* for accessing names which are structure members or names */
23 blevel, /* block level: 0 for extern, 1 for ftn args, >=2 inside function */
24 curdim; /* current offset into the dimension table */
25
26int dimtab[ DIMTABSZ ];
27
28int paramstk[ PARAMSZ ]; /* used in the definition of function parameters */
29int paramno; /* the number of parameters */
30int autooff, /* the next unused automatic offset */
31 argoff, /* the next unused argument offset */
32 strucoff; /* the next structure offset position */
33int regvar; /* the next free register for register variables */
34int minrvar; /* the smallest that regvar gets witing a function */
35OFFSZ inoff; /* offset of external element being initialized */
36int brkflag = 0; /* complain about break statements not reached */
37
38struct sw swtab[SWITSZ]; /* table for cases within a switch */
39struct sw *swp; /* pointer to next free entry in swtab */
40int swx; /* index of beginning of cases for current switch */
41
42/* debugging flag */
43int xdebug = 0;
44
45int strflg; /* if on, strings are to be treated as lists */
46
47int reached; /* true if statement can be reached... */
48
49int idname; /* tunnel to buildtree for name id's */
50
51
52NODE node[TREESZ];
53
54int cflag = 0; /* do we check for funny casts */
55int hflag = 0; /* do we check for various heuristics which may indicate errors */
56int pflag = 0; /* do we check for portable constructions */
57
58int brklab;
59int contlab;
60int flostat;
61int retlab = NOLAB;
62int retstat;
63
64/* save array for break, continue labels, and flostat */
65
66int asavbc[BCSZ];
67int *psavbc = asavbc ;
68
69static char *
70ccnames[] = { /* names of storage classes */
71 "SNULL",
72 "AUTO",
73 "EXTERN",
74 "STATIC",
75 "REGISTER",
76 "EXTDEF",
77 "LABEL",
78 "ULABEL",
79 "MOS",
80 "PARAM",
81 "STNAME",
82 "MOU",
83 "UNAME",
84 "TYPEDEF",
85 "FORTRAN",
86 "ENAME",
87 "MOE",
88 "UFORTRAN",
89 "USTATIC",
90 };
91
92char * scnames( c ) register c; {
93 /* return the name for storage class c */
94 static char buf[12];
95 if( c&FIELD ){
96 sprintf( buf, "FIELD[%d]", c&FLDSIZ );
97 return( buf );
98 }
99 return( ccnames[c] );
100 }