Add spl's around queue manipulation
[unix-history] / usr / src / usr.bin / error / error.h
CommitLineData
524aa063
SL
1/* error.h 1.4 83/08/11 */
2
c7be6007 3typedef int boolean;
58195f21 4#define reg register
c7be6007
BJ
5
6#define TRUE 1
7#define FALSE 0
58195f21
RH
8
9#define true 1
10#define false 0
c7be6007
BJ
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
243bdea5 33#define INTROFF 18
c7be6007
BJ
34
35extern 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 */
41typedef int Errorclass;
42
58195f21 43#define C_FIRST 0 /* first error category */
c7be6007
BJ
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 */
58195f21 53#define C_LAST 9 /* last error category */
c7be6007
BJ
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 */
60extern char *class_table[];
61extern int class_count[];
62
63#define nunknown class_count[C_UNKNOWN]
64#define nignore class_count[C_IGNORE]
58195f21 65#define nsyncerrors class_count[C_SYNC]
c7be6007
BJ
66#define ndiscard class_count[C_DISCARD]
67#define nnonspec class_count[C_NONSPEC]
68#define nthisfile class_count[C_THISFILE]
58195f21
RH
69#define nnulled class_count[C_NULLED]
70#define ntrue class_count[C_TRUE]
c7be6007
BJ
71#define ndupl class_count[C_DUPL]
72
73/* places to put the error complaints */
74
58195f21 75#define TOTHEFILE 1 /* touch the file */
c7be6007
BJ
76#define TOSTDOUT 2 /* just print them out (ho-hum) */
77
78FILE *errorfile; /* where error file comes from */
79FILE *queryfile; /* where the query responses from the user come from*/
80
81extern char *currentfilename;
82extern char *processname;
83extern char *scriptname;
84
85extern boolean query;
58195f21
RH
86extern boolean terse;
87int 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
96int 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
c7be6007
BJ
105/*
106 * Describes attributes about a language
107 */
108struct 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};
113extern 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 "####"
58195f21 124#define RIINCOMMENT CINCOMMENT
c7be6007 125#define RIOUTCOMMENT COUTCOMMENT
243bdea5
RH
126#define TROFFINCOMMENT ".\\\"###"
127#define TROFFOUTCOMMENT NEWLINE
c7be6007
BJ
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 */
58195f21
RH
134#define IG_FILE1 "llib-lc"
135#define IG_FILE2 "llib-port"
c7be6007
BJ
136#define IG_FILE3 "/usr/lib/llib-lc"
137#define IG_FILE4 "/usr/lib/llib-port"
138
58195f21 139#define ERRORNAME "/.errorrc"
c7be6007
BJ
140int nignored;
141char **names_ignored;
142/*
143 * Structure definition for a full error
144 */
58195f21
RH
145typedef struct edesc Edesc;
146typedef Edesc *Eptr;
147
148struct edesc{
149 Eptr error_next; /*linked together*/
c7be6007
BJ
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 */
162extern int nerrors;
58195f21
RH
163extern Eptr er_head;
164extern Eptr *errors;
c7be6007
BJ
165/*
166 * Resources for each of the files mentioned
167 */
168extern int nfiles;
58195f21
RH
169extern Eptr **files; /* array of pointers into errors*/
170boolean *touchedfiles; /* which files we touched */
c7be6007
BJ
171/*
172 * The langauge the compilation is in, as intuited from
173 * the flavor of error messages analyzed.
174 */
175extern int langauge;
176extern char *currentfilename;
177/*
178 * Functional forwards
179 */
180char *Calloc();
181char *strsave();
182char *clobberfirst();
183char lastchar();
184char firstchar();
185char next_lastchar();
186char **wordvsplice();
187int wordvcmp();
188boolean persperdexplode();
58195f21
RH
189/*
190 * Printing hacks
191 */
192char *plural(), *verbform();