1 /* 2 * @(#)error.h 1.3 (Berkeley) 06/14/83 3 */ 4 typedef int boolean; 5 #define reg register 6 7 #define TRUE 1 8 #define FALSE 0 9 10 #define true 1 11 #define false 0 12 /* 13 * Descriptors for the various languages we know about. 14 * If you touch these, also touch lang_table 15 */ 16 #define INUNKNOWN 0 17 #define INCPP 1 18 #define INCC 2 19 #define INAS 3 20 #define INLD 4 21 #define INLINT 5 22 #define INF77 6 23 #define INPI 7 24 #define INPC 8 25 #define INFRANZ 9 26 #define INLISP 10 27 #define INVAXIMA 11 28 #define INRATFOR 12 29 #define INLEX 13 30 #define INYACC 14 31 #define INAPL 15 32 #define INMAKE 16 33 #define INRI 17 34 #define INTROFF 18 35 36 extern int language; 37 /* 38 * We analyze each line in the error message file, and 39 * attempt to categorize it by type, as well as language. 40 * Here are the type descriptors. 41 */ 42 typedef int Errorclass; 43 44 #define C_FIRST 0 /* first error category */ 45 #define C_UNKNOWN 0 /* must be zero */ 46 #define C_IGNORE 1 /* ignore the message; used for pi */ 47 #define C_SYNC 2 /* synchronization errors */ 48 #define C_DISCARD 3 /* touches dangerous files, so discard */ 49 #define C_NONSPEC 4 /* not specific to any file */ 50 #define C_THISFILE 5 /* specific to this file, but at no line */ 51 #define C_NULLED 6 /* refers to special func; so null */ 52 #define C_TRUE 7 /* fits into true error format */ 53 #define C_DUPL 8 /* sub class only; duplicated error message */ 54 #define C_LAST 9 /* last error category */ 55 56 #define SORTABLE(x) (!(NOTSORTABLE(x))) 57 #define NOTSORTABLE(x) (x <= C_NONSPEC) 58 /* 59 * Resources to count and print out the error categories 60 */ 61 extern char *class_table[]; 62 extern int class_count[]; 63 64 #define nunknown class_count[C_UNKNOWN] 65 #define nignore class_count[C_IGNORE] 66 #define nsyncerrors class_count[C_SYNC] 67 #define ndiscard class_count[C_DISCARD] 68 #define nnonspec class_count[C_NONSPEC] 69 #define nthisfile class_count[C_THISFILE] 70 #define nnulled class_count[C_NULLED] 71 #define ntrue class_count[C_TRUE] 72 #define ndupl class_count[C_DUPL] 73 74 /* places to put the error complaints */ 75 76 #define TOTHEFILE 1 /* touch the file */ 77 #define TOSTDOUT 2 /* just print them out (ho-hum) */ 78 79 FILE *errorfile; /* where error file comes from */ 80 FILE *queryfile; /* where the query responses from the user come from*/ 81 82 extern char *currentfilename; 83 extern char *processname; 84 extern char *scriptname; 85 86 extern boolean query; 87 extern boolean terse; 88 int inquire(); /* inquire for yes/no */ 89 /* 90 * codes for inquire() to return 91 */ 92 #define Q_NO 1 /* 'N' */ 93 #define Q_no 2 /* 'n' */ 94 #define Q_YES 3 /* 'Y' */ 95 #define Q_yes 4 /* 'y' */ 96 97 int probethisfile(); 98 /* 99 * codes for probethisfile to return 100 */ 101 #define F_NOTEXIST 1 102 #define F_NOTREAD 2 103 #define F_NOTWRITE 3 104 #define F_TOUCHIT 4 105 106 /* 107 * Describes attributes about a language 108 */ 109 struct lang_desc{ 110 char *lang_name; 111 char *lang_incomment; /* one of the following defines */ 112 char *lang_outcomment; /* one of the following defines */ 113 }; 114 extern struct lang_desc lang_table[]; 115 116 #define CINCOMMENT "/*###" 117 #define COUTCOMMENT "%%%*/\n" 118 #define FINCOMMENT "C###" 119 #define FOUTCOMMENT "%%%\n" 120 #define NEWLINE "%%%\n" 121 #define PIINCOMMENT "(*###" 122 #define PIOUTCOMMENT "%%%*)\n" 123 #define LISPINCOMMENT ";###" 124 #define ASINCOMMENT "####" 125 #define RIINCOMMENT CINCOMMENT 126 #define RIOUTCOMMENT COUTCOMMENT 127 #define TROFFINCOMMENT ".\\\"###" 128 #define TROFFOUTCOMMENT NEWLINE 129 /* 130 * Defines and resources for determing if a given line 131 * is to be discarded because it refers to a file not to 132 * be touched, or if the function reference is to a 133 * function the user doesn't want recorded. 134 */ 135 #define IG_FILE1 "llib-lc" 136 #define IG_FILE2 "llib-port" 137 #define IG_FILE3 "/usr/lib/llib-lc" 138 #define IG_FILE4 "/usr/lib/llib-port" 139 140 #define ERRORNAME "/.errorrc" 141 int nignored; 142 char **names_ignored; 143 /* 144 * Structure definition for a full error 145 */ 146 typedef struct edesc Edesc; 147 typedef Edesc *Eptr; 148 149 struct edesc{ 150 Eptr error_next; /*linked together*/ 151 int error_lgtext; /* how many on the right hand side*/ 152 char **error_text; /* the right hand side proper*/ 153 Errorclass error_e_class; /* error category of this error*/ 154 Errorclass error_s_class; /* sub descriptor of error_e_class*/ 155 int error_language; /* the language for this error*/ 156 int error_position; /* oridinal position */ 157 int error_line; /* discovered line number*/ 158 int error_no; /* sequence number on input */ 159 }; 160 /* 161 * Resources for the true errors 162 */ 163 extern int nerrors; 164 extern Eptr er_head; 165 extern Eptr *errors; 166 /* 167 * Resources for each of the files mentioned 168 */ 169 extern int nfiles; 170 extern Eptr **files; /* array of pointers into errors*/ 171 boolean *touchedfiles; /* which files we touched */ 172 /* 173 * The langauge the compilation is in, as intuited from 174 * the flavor of error messages analyzed. 175 */ 176 extern int langauge; 177 extern char *currentfilename; 178 /* 179 * Functional forwards 180 */ 181 char *Calloc(); 182 char *strsave(); 183 char *clobberfirst(); 184 char lastchar(); 185 char firstchar(); 186 char next_lastchar(); 187 char **wordvsplice(); 188 int wordvcmp(); 189 boolean persperdexplode(); 190 /* 191 * Printing hacks 192 */ 193 char *plural(), *verbform(); 194