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