changed INDEX operator to handle multiple subscript arrays correctly
[unix-history] / usr / src / usr.bin / error / error.h
CommitLineData
c7be6007 1/*
58195f21 2 * @(#)error.h 1.2 (Berkeley) %G%
c7be6007
BJ
3 */
4typedef int boolean;
58195f21 5#define reg register
c7be6007
BJ
6
7#define TRUE 1
8#define FALSE 0
58195f21
RH
9
10#define true 1
11#define false 0
c7be6007
BJ
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
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
BJ
125#define RIOUTCOMMENT COUTCOMMENT
126/*
127 * Defines and resources for determing if a given line
128 * is to be discarded because it refers to a file not to
129 * be touched, or if the function reference is to a
130 * function the user doesn't want recorded.
131 */
58195f21
RH
132#define IG_FILE1 "llib-lc"
133#define IG_FILE2 "llib-port"
c7be6007
BJ
134#define IG_FILE3 "/usr/lib/llib-lc"
135#define IG_FILE4 "/usr/lib/llib-port"
136
58195f21 137#define ERRORNAME "/.errorrc"
c7be6007
BJ
138int nignored;
139char **names_ignored;
140/*
141 * Structure definition for a full error
142 */
58195f21
RH
143typedef struct edesc Edesc;
144typedef Edesc *Eptr;
145
146struct edesc{
147 Eptr error_next; /*linked together*/
c7be6007
BJ
148 int error_lgtext; /* how many on the right hand side*/
149 char **error_text; /* the right hand side proper*/
150 Errorclass error_e_class; /* error category of this error*/
151 Errorclass error_s_class; /* sub descriptor of error_e_class*/
152 int error_language; /* the language for this error*/
153 int error_position; /* oridinal position */
154 int error_line; /* discovered line number*/
155 int error_no; /* sequence number on input */
156};
157/*
158 * Resources for the true errors
159 */
160extern int nerrors;
58195f21
RH
161extern Eptr er_head;
162extern Eptr *errors;
c7be6007
BJ
163/*
164 * Resources for each of the files mentioned
165 */
166extern int nfiles;
58195f21
RH
167extern Eptr **files; /* array of pointers into errors*/
168boolean *touchedfiles; /* which files we touched */
c7be6007
BJ
169/*
170 * The langauge the compilation is in, as intuited from
171 * the flavor of error messages analyzed.
172 */
173extern int langauge;
174extern char *currentfilename;
175/*
176 * Functional forwards
177 */
178char *Calloc();
179char *strsave();
180char *clobberfirst();
181char lastchar();
182char firstchar();
183char next_lastchar();
184char **wordvsplice();
185int wordvcmp();
186boolean persperdexplode();
58195f21
RH
187/*
188 * Printing hacks
189 */
190char *plural(), *verbform();