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