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