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