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