xref: /original-bsd/usr.bin/pascal/pc3/pc3.h (revision d25e1985)
1     /* Copyright (c) 1980 Regents of the University of California */
2 
3     /*	static	char sccsid[] = "@(#)pc3.h 1.3 09/04/80"; */
4 
5     /*
6      *	a symbol table entry.
7      */
8 struct symbol {
9     char		*name;			/* pointer to string table */
10     short		desc;			/* symbol description */
11     int			lookup;			/* whether new or old */
12     union {					/* either */
13 	struct {				/*   for a symbol, */
14 	    struct symbol	*fromp;		/*     its defining .p file */
15 	    struct symbol	*fromi;		/*     its defining .i file */
16 	    long		iline;		/*     the .i file line */
17 	    struct symbol	*rfilep;	/*     its resolving file */
18 	    long		rline;		/*     resolving file line */
19 	}		sym_str;
20 	time_t		modtime;		/*   for a file, its st_mtime */
21     }			sym_un;
22 };
23 
24     /*
25      *	struct for an argument .o file.
26      */
27 struct fileinfo {
28     FILE		*file;
29     char		*name;
30     time_t		modtime;
31     off_t		nextoffset;
32 };
33 
34     /*
35      *	old archive magic for error detection.
36      */
37 #define	OARMAG	0177545
38 
39     /*
40      *	this is used to trim pointers into the range of a mod of a prime.
41      */
42 #define	SHORT_ABS( n )	( n & 077777 )
43 
44     /*
45      *	a prime number which gets sizeof( struct symboltableinfo )
46      *	up to a multiple of BUFSIZ.
47      */
48 #define	SYMBOLPRIME	1021
49 
50     /*
51      *	number of entries used in this symbol table,
52      *	a chain to the next symbol table,
53      *	and the entries. (pointers to struct symbols.)
54      */
55 struct symboltableinfo {
56     long			used;
57     struct symboltableinfo	*chain;
58     struct symbol		*entry[ SYMBOLPRIME ];
59 };
60 
61     /*
62      *	if new struct symbols are needed,
63      *	allocate this much space and hack it up into struct symbols.
64      */
65 #define	SYMBOLALLOC	BUFSIZ
66 
67     /*
68      *	a prime number which gets sizeof( struct stringtableinfo )
69      *	up to a multiple of BUFSIZ.
70      */
71 #define	STRINGPRIME	1021
72 
73     /*
74      *	number of entries used in this string table,
75      *	a chain to the next string table,
76      *	and the entries. (pointers to the character table.)
77      */
78 struct stringtableinfo {
79     long			used;
80     struct stringtableinfo	*chain;
81     char			*entry[ STRINGPRIME ];
82 };
83 
84     /*
85      *	if more character table space is needed,
86      *	allocate this much and hack it up into strings.
87      */
88 #define	CHARALLOC	BUFSIZ
89 
90     /*
91      *	uninitialized pointer
92      */
93 #define	NIL	0
94 
95     /*
96      *	an enumeration for error types
97      */
98 #define	FATAL	0
99 #define	WARNING	1
100 
101     /*
102      *	an enumeration for lookups
103      */
104 #define	NEW	0
105 #define	OLD	1
106 
107     /*
108      *	booleans
109      */
110 #define	BOOL	int
111 #define	FALSE	0
112 #define	TRUE	1
113 
114     /*
115      *	function types.
116      */
117 struct symbol	*entersymbol();
118 struct symbol	*symbolalloc();
119 long		stringhash();
120 char		*enterstring();
121 char		*charalloc();
122 BOOL		nextelement();
123 time_t		mtime();
124 char		*classify();
125