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