Commit | Line | Data |
---|---|---|
701fddb1 PK |
1 | /* Copyright (c) 1980 Regents of the University of California */ |
2 | ||
a65b6a9e | 3 | /* static char sccsid[] = "@(#)pc3.h 1.5 %G%"; */ |
701fddb1 PK |
4 | |
5 | /* | |
6 | * a symbol table entry. | |
7 | */ | |
8 | struct 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 |
27 | struct 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 | */ | |
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 | /* | |
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 | */ | |
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 | ||
8e79e0ed PK |
90 | /* |
91 | * uninitialized pointer | |
92 | */ | |
93 | #define NIL 0 | |
94 | ||
701fddb1 PK |
95 | /* |
96 | * an enumeration for error types | |
97 | */ | |
f54dd2f6 | 98 | #define NONE 0 |
701fddb1 | 99 | #define WARNING 1 |
f54dd2f6 PK |
100 | #define ERROR 2 |
101 | #define FATAL 3 | |
701fddb1 PK |
102 | |
103 | /* | |
104 | * an enumeration for lookups | |
105 | */ | |
106 | #define NEW 0 | |
107 | #define OLD 1 | |
108 | ||
109 | /* | |
110 | * booleans | |
111 | */ | |
112 | #define BOOL int | |
113 | #define FALSE 0 | |
114 | #define TRUE 1 | |
115 | ||
116 | /* | |
117 | * function types. | |
118 | */ | |
119 | struct symbol *entersymbol(); | |
120 | struct symbol *symbolalloc(); | |
121 | long stringhash(); | |
122 | char *enterstring(); | |
123 | char *charalloc(); | |
124 | BOOL nextelement(); | |
125 | time_t mtime(); | |
126 | char *classify(); | |
a65b6a9e | 127 | char *article(); |