Debian Codegraph @

texk/web2c/omegafonts/error_routines.c

raw
1 /* error_routines.c: General error routines.
2
3 This file is part of Omega,
4 which is based on the web2c distribution of TeX,
5
6 Copyright 1994--2018 John Plaice and Yannis Haralambous
7
8 Omega is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
12
13 Omega is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with Omega; if not, write to the Free Software Foundation, Inc.,
20 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
21
22 */
23
24 #include "cpascal.h"
25 #include "parser.h"
26 #include "error_routines.h"
27
28 int num_errors = 0;
29
30 /* Error routines:
31
32 All of the routines in this file have the same general format.
33 They
34
35 */
36
37 void
38 lex_error_1(const_string fmt, int item)
39 {
40 fprintf(stderr, "line %d (lexing): ", line_number);
41 fprintf(stderr, fmt, item);
42 fprintf(stderr, "\n");
43 }
44
45 void
46 lex_error_s(const_string fmt, const_string item)
47 {
48 fprintf(stderr, "line %d (lexing): ", line_number);
49 fprintf(stderr, fmt, item);
50 fprintf(stderr, "\n");
51 }
52
53 void
54 lex_error_s_1(const_string fmt, const_string item, int item1)
55 {
56 fprintf(stderr, "line %d (lexing): ", line_number);
57 fprintf(stderr, fmt, item, item1);
58 fprintf(stderr, "\n");
59 }
60
61 void
62 yyerror(const_string fmt)
63 {
64 fprintf(stderr, "line %d (parsing): ", line_number);
65 fprintf(stderr, "%s", fmt);
66 fprintf(stderr, "\n");
67 num_errors++;
68 }
69
70
71 void
72 warning_0(const_string fmt)
73 {
74 fprintf(stderr, "line %d (warning): ", line_number);
75 fprintf(stderr, "%s", fmt);
76 fprintf(stderr, "\n");
77 }
78
79 void
80 warning_1(const_string fmt, int item)
81 {
82 fprintf(stderr, "line %d (warning): ", line_number);
83 fprintf(stderr, fmt, item);
84 fprintf(stderr, "\n");
85 }
86
87 void
88 warning_2(const_string fmt, int item, int item2)
89 {
90 fprintf(stderr, "line %d (warning): ", line_number);
91 fprintf(stderr, fmt, item, item2);
92 fprintf(stderr, "\n");
93 }
94
95 void
96 warning_s(const_string fmt, const_string item)
97 {
98 fprintf(stderr, "line %d (warning): ", line_number);
99 fprintf(stderr, fmt, item);
100 fprintf(stderr, "\n");
101 }
102
103 void
104 warning_s_1(const_string fmt, const_string item, int item1)
105 {
106 fprintf(stderr, "line %d (warning): ", line_number);
107 fprintf(stderr, fmt, item, item1);
108 fprintf(stderr, "\n");
109 }
110
111 void
112 warning_s_2(const_string fmt, const_string item, int item1, int item2)
113 {
114 fprintf(stderr, "line %d (warning): ", line_number);
115 fprintf(stderr, fmt, item, item1, item2);
116 fprintf(stderr, "\n");
117 }
118
119 void
120 fatal_error_0(const_string fmt)
121 {
122 fprintf(stderr, "line %d (fatal): ", line_number);
123 fprintf(stderr, "%s", fmt);
124 fprintf(stderr, "\n");
125 exit(1);
126 }
127
128 void
129 fatal_error_1(const_string fmt, int item)
130 {
131 fprintf(stderr, "line %d (fatal): ", line_number);
132 fprintf(stderr, fmt, item);
133 fprintf(stderr, "\n");
134 exit(1);
135 }
136
137 void
138 fatal_error_2(const_string fmt, int item, int item2)
139 {
140 fprintf(stderr, "line %d (fatal): ", line_number);
141 fprintf(stderr, fmt, item, item2);
142 fprintf(stderr, "\n");
143 exit(1);
144 }
145
146 void
147 fatal_error_s(const_string fmt, const_string item)
148 {
149 fprintf(stderr, "line %d (fatal): ", line_number);
150 fprintf(stderr, fmt, item);
151 fprintf(stderr, "\n");
152 exit(1);
153 }
154
155 void
156 internal_error_0(const_string fmt)
157 {
158 fprintf(stderr, "line %d (internal): ", line_number);
159 fprintf(stderr, "%s", fmt);
160 fprintf(stderr, "\n");
161 exit(2);
162 }
163
164 void
165 internal_error_1(const_string fmt, int item)
166 {
167 fprintf(stderr, "line %d (internal): ", line_number);
168 fprintf(stderr, fmt, item);
169 fprintf(stderr, "\n");
170 exit(2);
171 }