Fix typo in OIDs corresponding to SHA256, SHA384, and SHA512 (#21707)
[mono-project.git] / mcs / jay / error.c
blob243a260fe7e3b4c00653c1b364c660c0330b2e0b
1 /*
2 * Copyright (c) 1989 The Regents of the University of California.
3 * All rights reserved.
5 * This code is derived from software contributed to Berkeley by
6 * Robert Paul Corbett.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. All advertising materials mentioning features or use of this software
17 * must display the following acknowledgement:
18 * This product includes software developed by the University of
19 * California, Berkeley and its contributors.
20 * 4. Neither the name of the University nor the names of its contributors
21 * may be used to endorse or promote products derived from this software
22 * without specific prior written permission.
24 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
37 #ifndef lint
38 static char sccsid[] = "@(#)error.c 5.3 (Berkeley) 6/1/90";
39 #endif /* not lint */
41 /* routines for printing error messages */
43 #include "defs.h"
45 void
46 fatal (const char *msg)
48 fprintf(stderr, "%s: f - %s\n", myname, msg);
49 done(2);
52 void
53 no_space (void)
55 fprintf(stderr, "%s: f - out of space\n", myname);
56 done(2);
59 void
60 open_error (const char *filename)
62 fprintf(stderr, "%s: f - cannot open \"%s\"\n", myname, filename);
63 done(2);
66 void
67 unexpected_EOF (void)
69 fprintf(stderr, "%s: e - line %d of \"%s\", unexpected end-of-file\n",
70 myname, lineno, input_file_name);
71 done(1);
74 static void
75 print_pos (const char *st_line, const char *st_cptr)
77 const char *s;
79 if (st_line == 0) return;
80 for (s = st_line; *s != '\n'; ++s)
82 if (isprint(*s) || *s == '\t')
83 putc(*s, stderr);
84 else
85 putc('?', stderr);
87 putc('\n', stderr);
88 for (s = st_line; s < st_cptr; ++s)
90 if (*s == '\t')
91 putc('\t', stderr);
92 else
93 putc(' ', stderr);
95 putc('^', stderr);
96 putc('\n', stderr);
99 void
100 syntax_error (int st_lineno, const char *st_line, const char *st_cptr)
102 fprintf(stderr, "%s: e - line %d of \"%s\", syntax error\n",
103 myname, st_lineno, input_file_name);
104 print_pos(st_line, st_cptr);
105 done(1);
108 void
109 unterminated_comment (int c_lineno, const char *c_line, const char *c_cptr)
111 fprintf(stderr, "%s: e - line %d of \"%s\", unmatched /*\n",
112 myname, c_lineno, input_file_name);
113 print_pos(c_line, c_cptr);
114 done(1);
117 void
118 unterminated_string (int s_lineno, const char *s_line, const char *s_cptr)
120 fprintf(stderr, "%s: e - line %d of \"%s\", unterminated string\n",
121 myname, s_lineno, input_file_name);
122 print_pos(s_line, s_cptr);
123 done(1);
126 void
127 unterminated_text (int t_lineno, const char *t_line, const char *t_cptr)
129 fprintf(stderr, "%s: e - line %d of \"%s\", unmatched %%{\n",
130 myname, t_lineno, input_file_name);
131 print_pos(t_line, t_cptr);
132 done(1);
135 void
136 illegal_tag (int t_lineno, const char *t_line, const char *t_cptr)
138 fprintf(stderr, "%s: e - line %d of \"%s\", illegal tag\n",
139 myname, t_lineno, input_file_name);
140 print_pos(t_line, t_cptr);
141 done(1);
144 void
145 illegal_character (const char *c_cptr)
147 fprintf(stderr, "%s: e - line %d of \"%s\", illegal character\n",
148 myname, lineno, input_file_name);
149 print_pos(line, c_cptr);
150 done(1);
153 void
154 used_reserved (const char *s)
156 fprintf(stderr, "%s: e - line %d of \"%s\", illegal use of reserved symbol \
157 %s\n", myname, lineno, input_file_name, s);
158 done(1);
161 void
162 tokenized_start (const char *s)
164 fprintf(stderr, "%s: e - line %d of \"%s\", the start symbol %s cannot be \
165 declared to be a token\n", myname, lineno, input_file_name, s);
166 done(1);
169 void
170 retyped_warning (const char *s)
172 fprintf(stderr, "%s: w - line %d of \"%s\", the type of %s has been \
173 redeclared\n", myname, lineno, input_file_name, s);
176 void
177 reprec_warning (const char *s)
179 fprintf(stderr, "%s: w - line %d of \"%s\", the precedence of %s has been \
180 redeclared\n", myname, lineno, input_file_name, s);
183 void
184 revalued_warning (const char *s)
186 fprintf(stderr, "%s: w - line %d of \"%s\", the value of %s has been \
187 redeclared\n", myname, lineno, input_file_name, s);
190 void
191 terminal_start (const char *s)
193 fprintf(stderr, "%s: e - line %d of \"%s\", the start symbol %s is a \
194 token\n", myname, lineno, input_file_name, s);
195 done(1);
198 void
199 restarted_warning (void)
201 fprintf(stderr, "%s: w - line %d of \"%s\", the start symbol has been \
202 redeclared\n", myname, lineno, input_file_name);
205 void
206 no_grammar (void)
208 fprintf(stderr, "%s: e - line %d of \"%s\", no grammar has been \
209 specified\n", myname, lineno, input_file_name);
210 done(1);
213 void
214 terminal_lhs (int s_lineno)
216 fprintf(stderr, "%s: e - line %d of \"%s\", a token appears on the lhs \
217 of a production\n", myname, s_lineno, input_file_name);
218 done(1);
221 void
222 prec_redeclared (void)
224 fprintf(stderr, "%s: w - line %d of \"%s\", conflicting %%prec \
225 specifiers\n", myname, lineno, input_file_name);
228 void
229 unterminated_action (int a_lineno, const char *a_line, const char *a_cptr)
231 fprintf(stderr, "%s: e - line %d of \"%s\", unterminated action\n",
232 myname, a_lineno, input_file_name);
233 print_pos(a_line, a_cptr);
234 done(1);
237 void
238 dollar_warning (int a_lineno, int i)
240 fprintf(stderr, "%s: w - line %d of \"%s\", $%d references beyond the \
241 end of the current rule\n", myname, a_lineno, input_file_name, i);
244 void
245 dollar_error (int a_lineno, const char *a_line, char *a_cptr)
247 fprintf(stderr, "%s: e - line %d of \"%s\", illegal $-name\n",
248 myname, a_lineno, input_file_name);
249 print_pos(a_line, a_cptr);
250 done(1);
253 void
254 untyped_lhs (void)
256 fprintf(stderr, "%s: w - line %d of \"%s\", $$ is untyped\n",
257 myname, lineno, input_file_name);
258 /** done(1); */
261 void
262 untyped_rhs (int i, const char *s)
264 fprintf(stderr, "%s: w - line %d of \"%s\", $%d (%s) is untyped\n",
265 myname, lineno, input_file_name, i, s);
266 /** done(1); */
269 void
270 unknown_rhs (int i)
272 fprintf(stderr, "%s: e - line %d of \"%s\", $%d is untyped\n",
273 myname, lineno, input_file_name, i);
274 done(1);
277 void
278 default_action_warning (void)
280 fprintf(stderr, "%s: w - line %d of \"%s\", the default action assigns an \
281 undefined value to $$\n", myname, lineno, input_file_name);
284 void
285 undefined_goal (const char *s)
287 fprintf(stderr, "%s: e - the start symbol %s is undefined\n", myname, s);
288 done(1);
291 void
292 undefined_symbol_warning (const char *s)
294 fprintf(stderr, "%s: w - the symbol %s is undefined\n", myname, s);