date and time created 82/01/18 19:20:24 by linton
[unix-history] / usr / src / usr.bin / pascal / pc3 / pc3.h
CommitLineData
701fddb1
PK
1 /* Copyright (c) 1980 Regents of the University of California */
2
99f6998f 3 /* static char sccsid[] = "@(#)pc3.h 1.3 %G%"; */
701fddb1
PK
4
5 /*
6 * a symbol table entry.
7 */
8struct symbol {
9 char *name; /* pointer to string table */
99f6998f 10 short desc; /* symbol description */
701fddb1
PK
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 */
99f6998f 19 } sym_str;
701fddb1
PK
20 time_t modtime; /* for a file, its st_mtime */
21 } sym_un;
22};
23
8e79e0ed
PK
24 /*
25 * struct for an argument .o file.
26 */
701fddb1
PK
27struct fileinfo {
28 FILE *file;
29 char *name;
30 time_t modtime;
31 off_t nextoffset;
32};
33
8e79e0ed
PK
34 /*
35 * old archive magic for error detection.
36 */
701fddb1
PK
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 /*
8e79e0ed
PK
45 * a prime number which gets sizeof( struct symboltableinfo )
46 * up to a multiple of BUFSIZ.
701fddb1
PK
47 */
48#define SYMBOLPRIME 1021
8e79e0ed 49
701fddb1
PK
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 */
55struct 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 /*
8e79e0ed
PK
68 * a prime number which gets sizeof( struct stringtableinfo )
69 * up to a multiple of BUFSIZ.
701fddb1
PK
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 */
78struct 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
8e79e0ed
PK
90 /*
91 * uninitialized pointer
92 */
93#define NIL 0
94
701fddb1
PK
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 */
117struct symbol *entersymbol();
118struct symbol *symbolalloc();
119long stringhash();
120char *enterstring();
121char *charalloc();
122BOOL nextelement();
123time_t mtime();
124char *classify();