117750Sralph #ifndef lint
2*18397Sralph static char *sccsid ="@(#)xdefs.c 4.3 (Berkeley) 03/19/85";
317750Sralph #endif lint
417750Sralph
5*18397Sralph # include "pass1.h"
617725Sralph
717725Sralph /* communication between lexical routines */
817725Sralph
917725Sralph char ftitle[100] = ""; /* title of the file */
1017725Sralph char ititle[100] = ""; /* title of initial file */
1117725Sralph int lineno; /* line number of the input file */
1217725Sralph
1317725Sralph CONSZ lastcon; /* the last constant read by the lexical analyzer */
1417750Sralph float fcon; /* the last float read by the lexical analyzer */
1517725Sralph double dcon; /* the last double read by the lexical analyzer */
1617725Sralph
1717725Sralph
1817725Sralph /* symbol table maintainence */
1917725Sralph
2017725Sralph struct symtab stab[SYMTSZ+1]; /* one extra slot for scratch */
2117725Sralph
2217725Sralph int curftn; /* "current" function */
2317725Sralph int ftnno; /* "current" function number */
2417725Sralph
2517725Sralph int curclass, /* current storage class */
2617725Sralph instruct, /* "in structure" flag */
2717725Sralph stwart, /* for accessing names which are structure members or names */
2817725Sralph blevel, /* block level: 0 for extern, 1 for ftn args, >=2 inside function */
2917725Sralph curdim; /* current offset into the dimension table */
3017725Sralph
3117725Sralph int dimtab[ DIMTABSZ ];
3217725Sralph
3317725Sralph int paramstk[ PARAMSZ ]; /* used in the definition of function parameters */
3417725Sralph int paramno; /* the number of parameters */
3517725Sralph int autooff, /* the next unused automatic offset */
3617725Sralph argoff, /* the next unused argument offset */
3717725Sralph strucoff; /* the next structure offset position */
3817725Sralph int regvar; /* the next free register for register variables */
3917725Sralph int minrvar; /* the smallest that regvar gets witing a function */
4017725Sralph OFFSZ inoff; /* offset of external element being initialized */
4117725Sralph int brkflag = 0; /* complain about break statements not reached */
4217725Sralph
4317725Sralph struct sw swtab[SWITSZ]; /* table for cases within a switch */
4417725Sralph struct sw *swp; /* pointer to next free entry in swtab */
4517725Sralph int swx; /* index of beginning of cases for current switch */
4617725Sralph
4717725Sralph /* debugging flag */
4817725Sralph int xdebug = 0;
4917725Sralph
5017725Sralph int strflg; /* if on, strings are to be treated as lists */
5117725Sralph
5217725Sralph int reached; /* true if statement can be reached... */
5317725Sralph
5417725Sralph int idname; /* tunnel to buildtree for name id's */
5517725Sralph
5617725Sralph
5717725Sralph NODE node[TREESZ];
5817725Sralph
5917725Sralph int cflag = 0; /* do we check for funny casts */
6017725Sralph int hflag = 0; /* do we check for various heuristics which may indicate errors */
6117725Sralph int pflag = 0; /* do we check for portable constructions */
6217725Sralph
6317725Sralph int brklab;
6417725Sralph int contlab;
6517725Sralph int flostat;
6617725Sralph int retlab = NOLAB;
6717725Sralph int retstat;
6817725Sralph
6917725Sralph /* save array for break, continue labels, and flostat */
7017725Sralph
7117725Sralph int asavbc[BCSZ];
7217725Sralph int *psavbc = asavbc ;
7317725Sralph
7417725Sralph # ifndef BUG1
7517725Sralph static char *
7617725Sralph ccnames[] = { /* names of storage classes */
7717725Sralph "SNULL",
7817725Sralph "AUTO",
7917725Sralph "EXTERN",
8017725Sralph "STATIC",
8117725Sralph "REGISTER",
8217725Sralph "EXTDEF",
8317725Sralph "LABEL",
8417725Sralph "ULABEL",
8517725Sralph "MOS",
8617725Sralph "PARAM",
8717725Sralph "STNAME",
8817725Sralph "MOU",
8917725Sralph "UNAME",
9017725Sralph "TYPEDEF",
9117725Sralph "FORTRAN",
9217725Sralph "ENAME",
9317725Sralph "MOE",
9417725Sralph "UFORTRAN",
9517725Sralph "USTATIC",
9617725Sralph };
9717725Sralph
scnames(c)9817725Sralph char * scnames( c ) register c; {
9917725Sralph /* return the name for storage class c */
10017725Sralph static char buf[12];
10117725Sralph if( c&FIELD ){
10217725Sralph sprintf( buf, "FIELD[%d]", c&FLDSIZ );
10317725Sralph return( buf );
10417725Sralph }
10517725Sralph return( ccnames[c] );
10617725Sralph }
10717725Sralph # endif
108