This is Unofficial EPICS BASE Doxygen Site
error.c
Go to the documentation of this file.
1 /*************************************************************************\
2 * Copyright (c) 2002 The University of Chicago, as Operator of Argonne
3 * National Laboratory.
4 * Copyright (c) 2002 The Regents of the University of California, as
5 * Operator of Los Alamos National Laboratory.
6 * EPICS BASE is distributed subject to a Software License Agreement found
7 * in file LICENSE that is included with this distribution.
8 \*************************************************************************/
9 /* routines for printing error messages */
10 
11 #include "defs.h"
12 
13 
14 void
15 fatal(char *msg)
16 {
17  fprintf(stderr, "%s: fatal - %s\n", myname, msg);
18  done(2);
19 }
20 
21 
22 void
23 no_space(void)
24 {
25  fprintf(stderr, "%s: fatal - out of space\n", myname);
26  done(2);
27 }
28 
29 
30 void
31 open_error(char *filename)
32 {
33  fprintf(stderr, "%s: fatal - cannot open \"%s\"\n", myname, filename);
34  done(2);
35 }
36 
37 
38 void
40 {
41  fprintf(stderr, "%s: error - line %d of \"%s\", unexpected end-of-file\n",
43  done(1);
44 }
45 
46 
47 static int
48 print_pos(char *st_line, char *st_cptr)
49 {
50  char *s;
51 
52  if (st_line == 0) return(0);
53  for (s = st_line; *s != '\n'; ++s)
54  {
55  if (isprint((int) *s) || *s == '\t')
56  putc(*s, stderr);
57  else
58  putc('?', stderr);
59  }
60  putc('\n', stderr);
61  for (s = st_line; s < st_cptr; ++s)
62  {
63  if (*s == '\t')
64  putc('\t', stderr);
65  else
66  putc(' ', stderr);
67  }
68  putc('^', stderr);
69  putc('\n', stderr);
70  return(0);
71 }
72 
73 
74 void
75 syntax_error(int st_lineno, char *st_line, char *st_cptr)
76 {
77  fprintf(stderr, "%s: error - line %d of \"%s\", syntax error\n",
78  myname, st_lineno, input_file_name);
79  print_pos(st_line, st_cptr);
80  done(1);
81 }
82 
83 
84 void
85 unterminated_comment(int c_lineno, char *c_line, char *c_cptr)
86 {
87  fprintf(stderr, "%s: error - line %d of \"%s\", unmatched /*\n",
88  myname, c_lineno, input_file_name);
89  print_pos(c_line, c_cptr);
90  done(1);
91 }
92 
93 
94 void
95 unterminated_string(int s_lineno, char *s_line, char *s_cptr)
96 {
97  fprintf(stderr, "%s: error - line %d of \"%s\", unterminated string\n",
98  myname, s_lineno, input_file_name);
99  print_pos(s_line, s_cptr);
100  done(1);
101 }
102 
103 
104 void
105 unterminated_text(int t_lineno, char *t_line, char *t_cptr)
106 {
107  fprintf(stderr, "%s: error - line %d of \"%s\", unmatched %%{\n",
108  myname, t_lineno, input_file_name);
109  print_pos(t_line, t_cptr);
110  done(1);
111 }
112 
113 
114 void
115 unterminated_union(int u_lineno, char *u_line, char *u_cptr)
116 {
117  fprintf(stderr, "%s: error - line %d of \"%s\", unterminated %%union \
118 declaration\n", myname, u_lineno, input_file_name);
119  print_pos(u_line, u_cptr);
120  done(1);
121 }
122 
123 
124 void
125 over_unionized(char *u_cptr)
126 {
127  fprintf(stderr, "%s: error - line %d of \"%s\", too many %%union \
128 declarations\n", myname, lineno, input_file_name);
129  print_pos(line, u_cptr);
130  done(1);
131 }
132 
133 
134 void
135 illegal_tag(int t_lineno, char *t_line, char *t_cptr)
136 {
137  fprintf(stderr, "%s: error - line %d of \"%s\", illegal tag\n",
138  myname, t_lineno, input_file_name);
139  print_pos(t_line, t_cptr);
140  done(1);
141 }
142 
143 
144 void
145 illegal_character(char *c_cptr)
146 {
147  fprintf(stderr, "%s: error - line %d of \"%s\", illegal character\n",
149  print_pos(line, c_cptr);
150  done(1);
151 }
152 
153 
154 void
156 {
157  fprintf(stderr, "%s: error - line %d of \"%s\", illegal use of reserved symbol \
158 %s\n", myname, lineno, input_file_name, s);
159  done(1);
160 }
161 
162 
163 void
165 {
166  fprintf(stderr, "%s: error - line %d of \"%s\", the start symbol %s cannot be \
167 declared to be a token\n", myname, lineno, input_file_name, s);
168  done(1);
169 }
170 
171 
172 void
174 {
175  fprintf(stderr, "%s: warning - line %d of \"%s\", the type of %s has been \
176 redeclared\n", myname, lineno, input_file_name, s);
177 }
178 
179 
180 void
182 {
183  fprintf(stderr, "%s: warning - line %d of \"%s\", the precedence of %s has been \
184 redeclared\n", myname, lineno, input_file_name, s);
185 }
186 
187 
188 void
190 {
191  fprintf(stderr, "%s: warning - line %d of \"%s\", the value of %s has been \
192 redeclared\n", myname, lineno, input_file_name, s);
193 }
194 
195 
196 void
198 {
199  fprintf(stderr, "%s: error - line %d of \"%s\", the start symbol %s is a \
200 token\n", myname, lineno, input_file_name, s);
201  done(1);
202 }
203 
204 
205 void
207 {
208  fprintf(stderr, "%s: warning - line %d of \"%s\", the start symbol has been \
209 redeclared\n", myname, lineno, input_file_name);
210 }
211 
212 
213 void
215 {
216  fprintf(stderr, "%s: error - line %d of \"%s\", no grammar has been \
217 specified\n", myname, lineno, input_file_name);
218  done(1);
219 }
220 
221 
222 void
223 terminal_lhs(int s_lineno)
224 {
225  fprintf(stderr, "%s: error - line %d of \"%s\", a token appears on the lhs \
226 of a production\n", myname, s_lineno, input_file_name);
227  done(1);
228 }
229 
230 
231 void
233 {
234  fprintf(stderr, "%s: warning - line %d of \"%s\", conflicting %%prec \
235 specifiers\n", myname, lineno, input_file_name);
236 }
237 
238 
239 void
240 unterminated_action(int a_lineno, char *a_line, char *a_cptr)
241 {
242  fprintf(stderr, "%s: error - line %d of \"%s\", unterminated action\n",
243  myname, a_lineno, input_file_name);
244  print_pos(a_line, a_cptr);
245  done(1);
246 }
247 
248 
249 void
250 dollar_warning(int a_lineno, int i)
251 {
252  fprintf(stderr, "%s: warning - line %d of \"%s\", $%d references beyond the \
253 end of the current rule\n", myname, a_lineno, input_file_name, i);
254 }
255 
256 
257 void
258 dollar_error(int a_lineno, char *a_line, char *a_cptr)
259 {
260  fprintf(stderr, "%s: error - line %d of \"%s\", illegal $-name\n",
261  myname, a_lineno, input_file_name);
262  print_pos(a_line, a_cptr);
263  done(1);
264 }
265 
266 
267 void
269 {
270  fprintf(stderr, "%s: error - line %d of \"%s\", $$ is untyped\n",
272  done(1);
273 }
274 
275 
276 void
277 untyped_rhs(int i, char *s)
278 {
279  fprintf(stderr, "%s: error - line %d of \"%s\", $%d (%s) is untyped\n",
280  myname, lineno, input_file_name, i, s);
281  done(1);
282 }
283 
284 
285 void
287 {
288  fprintf(stderr, "%s: error - line %d of \"%s\", $%d is untyped\n",
290  done(1);
291 }
292 
293 
294 void
296 {
297  fprintf(stderr, "%s: warning - line %d of \"%s\", the default action assigns an \
298 undefined value to $$\n", myname, lineno, input_file_name);
299 }
300 
301 
302 void
304 {
305  fprintf(stderr, "%s: error - the start symbol %s is undefined\n", myname, s);
306  done(1);
307 }
308 
309 
310 void
312 {
313  fprintf(stderr, "%s: warning - the symbol %s is undefined\n", myname, s);
314 }
void restarted_warning(void)
Definition: error.c:206
void unterminated_text(int t_lineno, char *t_line, char *t_cptr)
Definition: error.c:105
void no_grammar(void)
Definition: error.c:214
int lineno
Definition: antelope.c:33
int i
Definition: scan.c:967
void illegal_tag(int t_lineno, char *t_line, char *t_cptr)
Definition: error.c:135
void revalued_warning(char *s)
Definition: error.c:189
void reprec_warning(char *s)
Definition: error.c:181
void syntax_error(int st_lineno, char *st_line, char *st_cptr)
Definition: error.c:75
void dollar_warning(int a_lineno, int i)
Definition: error.c:250
void unterminated_action(int a_lineno, char *a_line, char *a_cptr)
Definition: error.c:240
void untyped_rhs(int i, char *s)
Definition: error.c:277
void prec_redeclared(void)
Definition: error.c:232
void no_space(void)
Definition: error.c:23
void unknown_rhs(int i)
Definition: error.c:286
void unterminated_comment(int c_lineno, char *c_line, char *c_cptr)
Definition: error.c:85
char * line
Definition: reader.c:25
void untyped_lhs(void)
Definition: error.c:268
char * myname
Definition: antelope.c:30
void unterminated_string(int s_lineno, char *s_line, char *s_cptr)
Definition: error.c:95
void over_unionized(char *u_cptr)
Definition: error.c:125
void default_action_warning(void)
Definition: error.c:295
void unterminated_union(int u_lineno, char *u_line, char *u_cptr)
Definition: error.c:115
void terminal_start(char *s)
Definition: error.c:197
void retyped_warning(char *s)
Definition: error.c:173
void illegal_character(char *c_cptr)
Definition: error.c:145
void dollar_error(int a_lineno, char *a_line, char *a_cptr)
Definition: error.c:258
void terminal_lhs(int s_lineno)
Definition: error.c:223
void done(int k)
Definition: antelope.c:77
void undefined_goal(char *s)
Definition: error.c:303
void fatal(char *msg)
Definition: error.c:15
void tokenized_start(char *s)
Definition: error.c:164
#define stderr
Definition: epicsStdio.h:32
void unexpected_EOF(void)
Definition: error.c:39
void used_reserved(char *s)
Definition: error.c:155
void open_error(char *filename)
Definition: error.c:31
void undefined_symbol_warning(char *s)
Definition: error.c:311
char * input_file_name
Definition: antelope.c:38