1 |
|
---|
2 | /* A Bison parser, made from mcy.y
|
---|
3 | by GNU Bison version 1.25
|
---|
4 | */
|
---|
5 |
|
---|
6 | #define YYBISON 1 /* Identify Bison output. */
|
---|
7 |
|
---|
8 | #define tSEVNAMES 258
|
---|
9 | #define tFACNAMES 259
|
---|
10 | #define tLANNAMES 260
|
---|
11 | #define tBASE 261
|
---|
12 | #define tCODEPAGE 262
|
---|
13 | #define tTYPEDEF 263
|
---|
14 | #define tNL 264
|
---|
15 | #define tSYMNAME 265
|
---|
16 | #define tMSGEND 266
|
---|
17 | #define tSEVERITY 267
|
---|
18 | #define tFACILITY 268
|
---|
19 | #define tLANGUAGE 269
|
---|
20 | #define tMSGID 270
|
---|
21 | #define tIDENT 271
|
---|
22 | #define tLINE 272
|
---|
23 | #define tFILE 273
|
---|
24 | #define tCOMMENT 274
|
---|
25 | #define tNUMBER 275
|
---|
26 | #define tTOKEN 276
|
---|
27 |
|
---|
28 |
|
---|
29 |
|
---|
30 |
|
---|
31 | #include "config.h"
|
---|
32 |
|
---|
33 | #include <stdio.h>
|
---|
34 | #include <stdlib.h>
|
---|
35 | #include <assert.h>
|
---|
36 |
|
---|
37 | #include "utils.h"
|
---|
38 | #include "wmc.h"
|
---|
39 | #include "lang.h"
|
---|
40 |
|
---|
41 | static const char err_syntax[] = "Syntax error";
|
---|
42 | static const char err_number[] = "Number expected";
|
---|
43 | static const char err_ident[] = "Identifier expected";
|
---|
44 | static const char err_assign[] = "'=' expected";
|
---|
45 | static const char err_popen[] = "'(' expected";
|
---|
46 | static const char err_pclose[] = "')' expected";
|
---|
47 | static const char err_colon[] = "':' expected";
|
---|
48 | static const char err_msg[] = "Message expected";
|
---|
49 |
|
---|
50 | /* Scanner switches */
|
---|
51 | int want_nl = 0; /* Request next newlinw */
|
---|
52 | int want_line = 0; /* Request next complete line */
|
---|
53 | int want_file = 0; /* Request next ident as filename */
|
---|
54 |
|
---|
55 | node_t *nodehead = NULL; /* The list of all parsed elements */
|
---|
56 | static node_t *nodetail = NULL;
|
---|
57 | lan_blk_t *lanblockhead; /* List of parsed elements transposed */
|
---|
58 |
|
---|
59 | static int base = 16; /* Current printout base to use (8, 10 or 16) */
|
---|
60 | static WCHAR *cast = NULL; /* Current typecast to use */
|
---|
61 |
|
---|
62 | static int last_id = 0; /* The last message ID parsed */
|
---|
63 | static int last_sev = 0; /* Last severity code parsed */
|
---|
64 | static int last_fac = 0; /* Last facility code parsed */
|
---|
65 | static WCHAR *last_sym = NULL;/* Last alias symbol parsed */
|
---|
66 | static int have_sev; /* Set if severity parsed for current message */
|
---|
67 | static int have_fac; /* Set if facility parsed for current message */
|
---|
68 | static int have_sym; /* Set is symbol parsed for current message */
|
---|
69 |
|
---|
70 | static cp_xlat_t *cpxlattab = NULL; /* Codepage translation table */
|
---|
71 | static int ncpxlattab = 0;
|
---|
72 |
|
---|
73 | /* Prototypes */
|
---|
74 | static WCHAR *merge(WCHAR *s1, WCHAR *s2);
|
---|
75 | static lanmsg_t *new_lanmsg(lan_cp_t *lcp, WCHAR *msg);
|
---|
76 | static msg_t *add_lanmsg(msg_t *msg, lanmsg_t *lanmsg);
|
---|
77 | static msg_t *complete_msg(msg_t *msg, int id);
|
---|
78 | static void add_node(node_e type, void *p);
|
---|
79 | static void do_add_token(tok_e type, token_t *tok, char *code);
|
---|
80 | static void test_id(int id);
|
---|
81 | static int check_languages(node_t *head);
|
---|
82 | static lan_blk_t *block_messages(node_t *head);
|
---|
83 | static void add_cpxlat(int lan, int cpin, int cpout);
|
---|
84 | static cp_xlat_t *find_cpxlat(int lan);
|
---|
85 |
|
---|
86 |
|
---|
87 |
|
---|
88 | typedef union {
|
---|
89 | WCHAR *str;
|
---|
90 | unsigned num;
|
---|
91 | token_t *tok;
|
---|
92 | lanmsg_t *lmp;
|
---|
93 | msg_t *msg;
|
---|
94 | lan_cp_t lcp;
|
---|
95 | } YYSTYPE;
|
---|
96 | #ifndef YYDEBUG
|
---|
97 | #define YYDEBUG 1
|
---|
98 | #endif
|
---|
99 |
|
---|
100 | #include <stdio.h>
|
---|
101 |
|
---|
102 | #ifndef __cplusplus
|
---|
103 | #ifndef __STDC__
|
---|
104 | #define const
|
---|
105 | #endif
|
---|
106 | #endif
|
---|
107 |
|
---|
108 |
|
---|
109 |
|
---|
110 | #define YYFINAL 155
|
---|
111 | #define YYFLAG -32768
|
---|
112 | #define YYNTBASE 27
|
---|
113 |
|
---|
114 | #define YYTRANSLATE(x) ((unsigned)(x) <= 276 ? yytranslate[x] : 58)
|
---|
115 |
|
---|
116 | static const char yytranslate[] = { 0,
|
---|
117 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
118 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
119 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
120 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 23,
|
---|
121 | 24, 2, 26, 2, 2, 2, 2, 2, 2, 2,
|
---|
122 | 2, 2, 2, 2, 2, 2, 2, 25, 2, 2,
|
---|
123 | 22, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
124 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
125 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
126 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
127 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
128 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
129 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
130 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
131 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
132 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
133 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
134 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
135 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
136 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
137 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
138 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
139 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
140 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
141 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
142 | 2, 2, 2, 2, 2, 1, 2, 3, 4, 5,
|
---|
143 | 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
|
---|
144 | 16, 17, 18, 19, 20, 21
|
---|
145 | };
|
---|
146 |
|
---|
147 | #if YYDEBUG != 0
|
---|
148 | static const short yyprhs[] = { 0,
|
---|
149 | 0, 2, 4, 7, 9, 11, 13, 15, 21, 27,
|
---|
150 | 31, 34, 40, 46, 50, 53, 59, 65, 69, 72,
|
---|
151 | 78, 84, 88, 91, 95, 99, 102, 106, 110, 113,
|
---|
152 | 115, 118, 120, 125, 129, 132, 134, 137, 139, 144,
|
---|
153 | 148, 151, 152, 155, 158, 160, 163, 165, 173, 180,
|
---|
154 | 185, 189, 192, 193, 196, 199, 201, 204, 206, 212,
|
---|
155 | 218, 223, 227, 230, 232, 234, 235, 240, 244, 247,
|
---|
156 | 248, 250, 253, 256, 257, 260, 263, 266, 270, 274,
|
---|
157 | 277, 281, 285, 288, 292, 296, 299, 301, 304, 306,
|
---|
158 | 311, 317, 323, 328, 331, 333, 336, 338, 341, 343,
|
---|
159 | 345, 346, 347
|
---|
160 | };
|
---|
161 |
|
---|
162 | static const short yyrhs[] = { 28,
|
---|
163 | 0, 29, 0, 28, 29, 0, 30, 0, 42, 0,
|
---|
164 | 19, 0, 1, 0, 3, 22, 23, 31, 24, 0,
|
---|
165 | 3, 22, 23, 31, 1, 0, 3, 22, 1, 0,
|
---|
166 | 3, 1, 0, 4, 22, 23, 33, 24, 0, 4,
|
---|
167 | 22, 23, 33, 1, 0, 4, 22, 1, 0, 4,
|
---|
168 | 1, 0, 5, 22, 23, 36, 24, 0, 5, 22,
|
---|
169 | 23, 36, 1, 0, 5, 22, 1, 0, 5, 1,
|
---|
170 | 0, 7, 22, 23, 39, 24, 0, 7, 22, 23,
|
---|
171 | 39, 1, 0, 7, 22, 1, 0, 7, 1, 0,
|
---|
172 | 8, 22, 16, 0, 8, 22, 1, 0, 8, 1,
|
---|
173 | 0, 6, 22, 20, 0, 6, 22, 1, 0, 6,
|
---|
174 | 1, 0, 32, 0, 31, 32, 0, 1, 0, 54,
|
---|
175 | 22, 20, 35, 0, 54, 22, 1, 0, 54, 1,
|
---|
176 | 0, 34, 0, 33, 34, 0, 1, 0, 54, 22,
|
---|
177 | 20, 35, 0, 54, 22, 1, 0, 54, 1, 0,
|
---|
178 | 0, 25, 16, 0, 25, 1, 0, 37, 0, 36,
|
---|
179 | 37, 0, 1, 0, 54, 22, 20, 57, 25, 18,
|
---|
180 | 38, 0, 54, 22, 20, 57, 25, 1, 0, 54,
|
---|
181 | 22, 20, 1, 0, 54, 22, 1, 0, 54, 1,
|
---|
182 | 0, 0, 25, 20, 0, 25, 1, 0, 40, 0,
|
---|
183 | 39, 40, 0, 1, 0, 41, 22, 20, 25, 20,
|
---|
184 | 0, 41, 22, 20, 25, 1, 0, 41, 22, 20,
|
---|
185 | 1, 0, 41, 22, 1, 0, 41, 1, 0, 20,
|
---|
186 | 0, 21, 0, 0, 44, 46, 43, 50, 0, 15,
|
---|
187 | 22, 45, 0, 15, 1, 0, 0, 20, 0, 26,
|
---|
188 | 20, 0, 26, 1, 0, 0, 46, 48, 0, 46,
|
---|
189 | 49, 0, 46, 47, 0, 10, 22, 16, 0, 10,
|
---|
190 | 22, 1, 0, 10, 1, 0, 12, 22, 54, 0,
|
---|
191 | 12, 22, 1, 0, 12, 1, 0, 13, 22, 54,
|
---|
192 | 0, 13, 22, 1, 0, 13, 1, 0, 51, 0,
|
---|
193 | 50, 51, 0, 1, 0, 52, 56, 53, 11, 0,
|
---|
194 | 14, 55, 22, 54, 9, 0, 14, 55, 22, 54,
|
---|
195 | 1, 0, 14, 55, 22, 1, 0, 14, 1, 0,
|
---|
196 | 17, 0, 53, 17, 0, 1, 0, 53, 1, 0,
|
---|
197 | 16, 0, 21, 0, 0, 0, 0
|
---|
198 | };
|
---|
199 |
|
---|
200 | #endif
|
---|
201 |
|
---|
202 | #if YYDEBUG != 0
|
---|
203 | static const short yyrline[] = { 0,
|
---|
204 | 124, 131, 132, 135, 136, 137, 138, 141, 142, 143,
|
---|
205 | 144, 145, 146, 147, 148, 149, 150, 151, 152, 153,
|
---|
206 | 154, 155, 156, 157, 158, 159, 160, 172, 173, 179,
|
---|
207 | 180, 181, 184, 191, 192, 198, 199, 200, 203, 210,
|
---|
208 | 211, 214, 215, 216, 222, 223, 224, 227, 235, 236,
|
---|
209 | 237, 238, 241, 242, 243, 249, 250, 251, 254, 264,
|
---|
210 | 265, 266, 267, 270, 271, 281, 281, 284, 289, 292,
|
---|
211 | 293, 294, 295, 298, 299, 300, 301, 304, 305, 306,
|
---|
212 | 309, 317, 318, 321, 329, 330, 336, 337, 338, 341,
|
---|
213 | 349, 378, 379, 380, 383, 384, 385, 386, 392, 393,
|
---|
214 | 396, 399, 402
|
---|
215 | };
|
---|
216 | #endif
|
---|
217 |
|
---|
218 |
|
---|
219 | #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
|
---|
220 |
|
---|
221 | static const char * const yytname[] = { "$","error","$undefined.","tSEVNAMES",
|
---|
222 | "tFACNAMES","tLANNAMES","tBASE","tCODEPAGE","tTYPEDEF","tNL","tSYMNAME","tMSGEND",
|
---|
223 | "tSEVERITY","tFACILITY","tLANGUAGE","tMSGID","tIDENT","tLINE","tFILE","tCOMMENT",
|
---|
224 | "tNUMBER","tTOKEN","'='","'('","')'","':'","'+'","file","items","decl","global",
|
---|
225 | "smaps","smap","fmaps","fmap","alias","lmaps","lmap","optcp","cmaps","cmap",
|
---|
226 | "clan","msg","@1","msgid","id","sevfacsym","sym","sev","fac","bodies","body",
|
---|
227 | "lang","lines","token","setnl","setline","setfile", NULL
|
---|
228 | };
|
---|
229 | #endif
|
---|
230 |
|
---|
231 | static const short yyr1[] = { 0,
|
---|
232 | 27, 28, 28, 29, 29, 29, 29, 30, 30, 30,
|
---|
233 | 30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
|
---|
234 | 30, 30, 30, 30, 30, 30, 30, 30, 30, 31,
|
---|
235 | 31, 31, 32, 32, 32, 33, 33, 33, 34, 34,
|
---|
236 | 34, 35, 35, 35, 36, 36, 36, 37, 37, 37,
|
---|
237 | 37, 37, 38, 38, 38, 39, 39, 39, 40, 40,
|
---|
238 | 40, 40, 40, 41, 41, 43, 42, 44, 44, 45,
|
---|
239 | 45, 45, 45, 46, 46, 46, 46, 47, 47, 47,
|
---|
240 | 48, 48, 48, 49, 49, 49, 50, 50, 50, 51,
|
---|
241 | 52, 52, 52, 52, 53, 53, 53, 53, 54, 54,
|
---|
242 | 55, 56, 57
|
---|
243 | };
|
---|
244 |
|
---|
245 | static const short yyr2[] = { 0,
|
---|
246 | 1, 1, 2, 1, 1, 1, 1, 5, 5, 3,
|
---|
247 | 2, 5, 5, 3, 2, 5, 5, 3, 2, 5,
|
---|
248 | 5, 3, 2, 3, 3, 2, 3, 3, 2, 1,
|
---|
249 | 2, 1, 4, 3, 2, 1, 2, 1, 4, 3,
|
---|
250 | 2, 0, 2, 2, 1, 2, 1, 7, 6, 4,
|
---|
251 | 3, 2, 0, 2, 2, 1, 2, 1, 5, 5,
|
---|
252 | 4, 3, 2, 1, 1, 0, 4, 3, 2, 0,
|
---|
253 | 1, 2, 2, 0, 2, 2, 2, 3, 3, 2,
|
---|
254 | 3, 3, 2, 3, 3, 2, 1, 2, 1, 4,
|
---|
255 | 5, 5, 4, 2, 1, 2, 1, 2, 1, 1,
|
---|
256 | 0, 0, 0
|
---|
257 | };
|
---|
258 |
|
---|
259 | static const short yydefact[] = { 0,
|
---|
260 | 7, 0, 0, 0, 0, 0, 0, 0, 6, 0,
|
---|
261 | 2, 4, 5, 74, 11, 0, 15, 0, 19, 0,
|
---|
262 | 29, 0, 23, 0, 26, 0, 69, 70, 3, 66,
|
---|
263 | 10, 0, 14, 0, 18, 0, 28, 27, 22, 0,
|
---|
264 | 25, 24, 71, 0, 68, 0, 0, 0, 0, 77,
|
---|
265 | 75, 76, 32, 99, 100, 0, 30, 0, 38, 0,
|
---|
266 | 36, 0, 47, 0, 45, 0, 58, 64, 65, 0,
|
---|
267 | 56, 0, 73, 72, 80, 0, 83, 0, 86, 0,
|
---|
268 | 89, 0, 67, 87, 102, 9, 8, 31, 35, 0,
|
---|
269 | 13, 12, 37, 41, 0, 17, 16, 46, 52, 0,
|
---|
270 | 21, 20, 57, 63, 0, 79, 78, 82, 81, 85,
|
---|
271 | 84, 94, 0, 88, 0, 34, 42, 40, 42, 51,
|
---|
272 | 0, 62, 0, 0, 97, 95, 0, 0, 33, 39,
|
---|
273 | 50, 0, 61, 0, 93, 0, 98, 90, 96, 44,
|
---|
274 | 43, 0, 60, 59, 92, 91, 49, 53, 0, 48,
|
---|
275 | 55, 54, 0, 0, 0
|
---|
276 | };
|
---|
277 |
|
---|
278 | static const short yydefgoto[] = { 153,
|
---|
279 | 10, 11, 12, 56, 57, 60, 61, 129, 64, 65,
|
---|
280 | 150, 70, 71, 72, 13, 49, 14, 45, 30, 50,
|
---|
281 | 51, 52, 83, 84, 85, 127, 58, 113, 115, 132
|
---|
282 | };
|
---|
283 |
|
---|
284 | static const short yypact[] = { 132,
|
---|
285 | -32768, 18, 44, 46, 47, 48, 49, 50,-32768, 113,
|
---|
286 | -32768,-32768,-32768,-32768,-32768, 11,-32768, 14,-32768, 19,
|
---|
287 | -32768, 85,-32768, 20,-32768, 147,-32768, -13,-32768, 87,
|
---|
288 | -32768, 66,-32768, 80,-32768, 82,-32768,-32768,-32768, 64,
|
---|
289 | -32768,-32768,-32768, 107,-32768, 51, 52, 53, 3,-32768,
|
---|
290 | -32768,-32768,-32768,-32768,-32768, 7,-32768, 54,-32768, 8,
|
---|
291 | -32768, 55,-32768, 17,-32768, 56,-32768,-32768,-32768, 15,
|
---|
292 | -32768, 57,-32768,-32768,-32768, 148,-32768, 88,-32768, 90,
|
---|
293 | -32768, 58, -4,-32768,-32768,-32768,-32768,-32768,-32768, 109,
|
---|
294 | -32768,-32768,-32768,-32768, 114,-32768,-32768,-32768,-32768, 121,
|
---|
295 | -32768,-32768,-32768,-32768, 122,-32768,-32768,-32768,-32768,-32768,
|
---|
296 | -32768,-32768, -11,-32768, 129,-32768, 35,-32768, 35,-32768,
|
---|
297 | 0,-32768, 2, 91,-32768,-32768, 144, 149,-32768,-32768,
|
---|
298 | -32768, 36,-32768, 123,-32768, 5,-32768,-32768,-32768,-32768,
|
---|
299 | -32768, 4,-32768,-32768,-32768,-32768,-32768, 37, 124,-32768,
|
---|
300 | -32768,-32768, 63, 93,-32768
|
---|
301 | };
|
---|
302 |
|
---|
303 | static const short yypgoto[] = {-32768,
|
---|
304 | -32768, 78,-32768,-32768, 38,-32768, 42, -55,-32768, 31,
|
---|
305 | -32768,-32768, 61,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
|
---|
306 | -32768,-32768,-32768, 43,-32768,-32768, -34,-32768,-32768,-32768
|
---|
307 | };
|
---|
308 |
|
---|
309 |
|
---|
310 | #define YYLAST 165
|
---|
311 |
|
---|
312 |
|
---|
313 | static const short yytable[] = { 62,
|
---|
314 | 131, 66, 133, 81, 147, 145, 43, 86, 91, 82,
|
---|
315 | 124, 31, 44, 146, 33, 101, 82, 96, 15, 35,
|
---|
316 | 39, 148, 54, 54, -103, 62, 134, 55, 55, 66,
|
---|
317 | 87, 92, 54, 32, 68, 69, 34, 55, 102, 16,
|
---|
318 | 97, 36, 40, 109, 17, 111, 19, 21, 23, 25,
|
---|
319 | 27, 75, 77, 79, 89, 94, 99, 104, 112, 128,
|
---|
320 | 142, 149, 154, 130, 67, 18, 53, 20, 22, 24,
|
---|
321 | 26, 28, 76, 78, 80, 90, 95, 100, 105, -101,
|
---|
322 | 59, 54, 63, 68, 69, 37, 55, 29, 108, 136,
|
---|
323 | 110, 135, 155, 88, 98, 54, 46, 54, 47, 48,
|
---|
324 | 55, 93, 55, 54, 38, 54, 54, 73, 55, 116,
|
---|
325 | 55, 55, -1, 1, 118, 2, 3, 4, 5, 6,
|
---|
326 | 7, 120, 122, 143, 151, 114, 74, 8, 117, 125,
|
---|
327 | 103, 9, 1, 119, 2, 3, 4, 5, 6, 7,
|
---|
328 | 121, 123, 144, 152, 137, 126, 8, 41, 106, 140,
|
---|
329 | 9, 0, 0, 0, 138, 0, 0, 0, 0, 0,
|
---|
330 | 139, 0, 42, 107, 141
|
---|
331 | };
|
---|
332 |
|
---|
333 | static const short yycheck[] = { 34,
|
---|
334 | 1, 36, 1, 1, 1, 1, 20, 1, 1, 14,
|
---|
335 | 22, 1, 26, 9, 1, 1, 14, 1, 1, 1,
|
---|
336 | 1, 18, 16, 16, 25, 60, 25, 21, 21, 64,
|
---|
337 | 24, 24, 16, 23, 20, 21, 23, 21, 24, 22,
|
---|
338 | 24, 23, 23, 78, 1, 80, 1, 1, 1, 1,
|
---|
339 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 25,
|
---|
340 | 25, 25, 0, 119, 1, 22, 1, 22, 22, 22,
|
---|
341 | 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
|
---|
342 | 1, 16, 1, 20, 21, 1, 21, 10, 1, 124,
|
---|
343 | 1, 1, 0, 56, 64, 16, 10, 16, 12, 13,
|
---|
344 | 21, 60, 21, 16, 20, 16, 16, 1, 21, 1,
|
---|
345 | 21, 21, 0, 1, 1, 3, 4, 5, 6, 7,
|
---|
346 | 8, 1, 1, 1, 1, 83, 20, 15, 20, 1,
|
---|
347 | 70, 19, 1, 20, 3, 4, 5, 6, 7, 8,
|
---|
348 | 20, 20, 20, 20, 1, 17, 15, 1, 1, 1,
|
---|
349 | 19, -1, -1, -1, 11, -1, -1, -1, -1, -1,
|
---|
350 | 17, -1, 16, 16, 16
|
---|
351 | };
|
---|
352 | /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
|
---|
353 |
|
---|
354 |
|
---|
355 | /* Skeleton output parser for bison,
|
---|
356 | Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
|
---|
357 |
|
---|
358 | This program is free software; you can redistribute it and/or modify
|
---|
359 | it under the terms of the GNU General Public License as published by
|
---|
360 | the Free Software Foundation; either version 2, or (at your option)
|
---|
361 | any later version.
|
---|
362 |
|
---|
363 | This program is distributed in the hope that it will be useful,
|
---|
364 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
365 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
366 | GNU General Public License for more details.
|
---|
367 |
|
---|
368 | You should have received a copy of the GNU General Public License
|
---|
369 | along with this program; if not, write to the Free Software
|
---|
370 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
---|
371 |
|
---|
372 | /* As a special exception, when this file is copied by Bison into a
|
---|
373 | Bison output file, you may use that output file without restriction.
|
---|
374 | This special exception was added by the Free Software Foundation
|
---|
375 | in version 1.24 of Bison. */
|
---|
376 |
|
---|
377 | #ifndef alloca
|
---|
378 | #ifdef __GNUC__
|
---|
379 | #define alloca __builtin_alloca
|
---|
380 | #else /* not GNU C. */
|
---|
381 | #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi)
|
---|
382 | #include <alloca.h>
|
---|
383 | #else /* not sparc */
|
---|
384 | #if defined (MSDOS) && !defined (__TURBOC__)
|
---|
385 | #include <malloc.h>
|
---|
386 | #else /* not MSDOS, or __TURBOC__ */
|
---|
387 | #if defined(_AIX)
|
---|
388 | #include <malloc.h>
|
---|
389 | #pragma alloca
|
---|
390 | #else /* not MSDOS, __TURBOC__, or _AIX */
|
---|
391 | #ifdef __hpux
|
---|
392 | #ifdef __cplusplus
|
---|
393 | extern "C" {
|
---|
394 | void *alloca (unsigned int);
|
---|
395 | };
|
---|
396 | #else /* not __cplusplus */
|
---|
397 | void *alloca ();
|
---|
398 | #endif /* not __cplusplus */
|
---|
399 | #endif /* __hpux */
|
---|
400 | #endif /* not _AIX */
|
---|
401 | #endif /* not MSDOS, or __TURBOC__ */
|
---|
402 | #endif /* not sparc. */
|
---|
403 | #endif /* not GNU C. */
|
---|
404 | #endif /* alloca not defined. */
|
---|
405 |
|
---|
406 | /* This is the parser code that is written into each bison parser
|
---|
407 | when the %semantic_parser declaration is not specified in the grammar.
|
---|
408 | It was written by Richard Stallman by simplifying the hairy parser
|
---|
409 | used when %semantic_parser is specified. */
|
---|
410 |
|
---|
411 | /* Note: there must be only one dollar sign in this file.
|
---|
412 | It is replaced by the list of actions, each action
|
---|
413 | as one case of the switch. */
|
---|
414 |
|
---|
415 | #define yyerrok (yyerrstatus = 0)
|
---|
416 | #define yyclearin (yychar = YYEMPTY)
|
---|
417 | #define YYEMPTY -2
|
---|
418 | #define YYEOF 0
|
---|
419 | #define YYACCEPT return(0)
|
---|
420 | #define YYABORT return(1)
|
---|
421 | #define YYERROR goto yyerrlab1
|
---|
422 | /* Like YYERROR except do call yyerror.
|
---|
423 | This remains here temporarily to ease the
|
---|
424 | transition to the new meaning of YYERROR, for GCC.
|
---|
425 | Once GCC version 2 has supplanted version 1, this can go. */
|
---|
426 | #define YYFAIL goto yyerrlab
|
---|
427 | #define YYRECOVERING() (!!yyerrstatus)
|
---|
428 | #define YYBACKUP(token, value) \
|
---|
429 | do \
|
---|
430 | if (yychar == YYEMPTY && yylen == 1) \
|
---|
431 | { yychar = (token), yylval = (value); \
|
---|
432 | yychar1 = YYTRANSLATE (yychar); \
|
---|
433 | YYPOPSTACK; \
|
---|
434 | goto yybackup; \
|
---|
435 | } \
|
---|
436 | else \
|
---|
437 | { yyerror ("syntax error: cannot back up"); YYERROR; } \
|
---|
438 | while (0)
|
---|
439 |
|
---|
440 | #define YYTERROR 1
|
---|
441 | #define YYERRCODE 256
|
---|
442 |
|
---|
443 | #ifndef YYPURE
|
---|
444 | #define YYLEX yylex()
|
---|
445 | #endif
|
---|
446 |
|
---|
447 | #ifdef YYPURE
|
---|
448 | #ifdef YYLSP_NEEDED
|
---|
449 | #ifdef YYLEX_PARAM
|
---|
450 | #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
|
---|
451 | #else
|
---|
452 | #define YYLEX yylex(&yylval, &yylloc)
|
---|
453 | #endif
|
---|
454 | #else /* not YYLSP_NEEDED */
|
---|
455 | #ifdef YYLEX_PARAM
|
---|
456 | #define YYLEX yylex(&yylval, YYLEX_PARAM)
|
---|
457 | #else
|
---|
458 | #define YYLEX yylex(&yylval)
|
---|
459 | #endif
|
---|
460 | #endif /* not YYLSP_NEEDED */
|
---|
461 | #endif
|
---|
462 |
|
---|
463 | /* If nonreentrant, generate the variables here */
|
---|
464 |
|
---|
465 | #ifndef YYPURE
|
---|
466 |
|
---|
467 | int yychar; /* the lookahead symbol */
|
---|
468 | YYSTYPE yylval; /* the semantic value of the */
|
---|
469 | /* lookahead symbol */
|
---|
470 |
|
---|
471 | #ifdef YYLSP_NEEDED
|
---|
472 | YYLTYPE yylloc; /* location data for the lookahead */
|
---|
473 | /* symbol */
|
---|
474 | #endif
|
---|
475 |
|
---|
476 | int yynerrs; /* number of parse errors so far */
|
---|
477 | #endif /* not YYPURE */
|
---|
478 |
|
---|
479 | #if YYDEBUG != 0
|
---|
480 | int yydebug; /* nonzero means print parse trace */
|
---|
481 | /* Since this is uninitialized, it does not stop multiple parsers
|
---|
482 | from coexisting. */
|
---|
483 | #endif
|
---|
484 |
|
---|
485 | /* YYINITDEPTH indicates the initial size of the parser's stacks */
|
---|
486 |
|
---|
487 | #ifndef YYINITDEPTH
|
---|
488 | #define YYINITDEPTH 200
|
---|
489 | #endif
|
---|
490 |
|
---|
491 | /* YYMAXDEPTH is the maximum size the stacks can grow to
|
---|
492 | (effective only if the built-in stack extension method is used). */
|
---|
493 |
|
---|
494 | #if YYMAXDEPTH == 0
|
---|
495 | #undef YYMAXDEPTH
|
---|
496 | #endif
|
---|
497 |
|
---|
498 | #ifndef YYMAXDEPTH
|
---|
499 | #define YYMAXDEPTH 10000
|
---|
500 | #endif
|
---|
501 |
|
---|
502 | /* Prevent warning if -Wstrict-prototypes. */
|
---|
503 | #ifdef __GNUC__
|
---|
504 | int yyparse (void);
|
---|
505 | #endif
|
---|
506 | |
---|
507 |
|
---|
508 | #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
|
---|
509 | #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
|
---|
510 | #else /* not GNU C or C++ */
|
---|
511 | #ifndef __cplusplus
|
---|
512 |
|
---|
513 | /* This is the most reliable way to avoid incompatibilities
|
---|
514 | in available built-in functions on various systems. */
|
---|
515 | static void
|
---|
516 | __yy_memcpy (to, from, count)
|
---|
517 | char *to;
|
---|
518 | char *from;
|
---|
519 | int count;
|
---|
520 | {
|
---|
521 | register char *f = from;
|
---|
522 | register char *t = to;
|
---|
523 | register int i = count;
|
---|
524 |
|
---|
525 | while (i-- > 0)
|
---|
526 | *t++ = *f++;
|
---|
527 | }
|
---|
528 |
|
---|
529 | #else /* __cplusplus */
|
---|
530 |
|
---|
531 | /* This is the most reliable way to avoid incompatibilities
|
---|
532 | in available built-in functions on various systems. */
|
---|
533 | static void
|
---|
534 | __yy_memcpy (char *to, char *from, int count)
|
---|
535 | {
|
---|
536 | register char *f = from;
|
---|
537 | register char *t = to;
|
---|
538 | register int i = count;
|
---|
539 |
|
---|
540 | while (i-- > 0)
|
---|
541 | *t++ = *f++;
|
---|
542 | }
|
---|
543 |
|
---|
544 | #endif
|
---|
545 | #endif
|
---|
546 | |
---|
547 |
|
---|
548 |
|
---|
549 |
|
---|
550 | /* The user can define YYPARSE_PARAM as the name of an argument to be passed
|
---|
551 | into yyparse. The argument should have type void *.
|
---|
552 | It should actually point to an object.
|
---|
553 | Grammar actions can access the variable by casting it
|
---|
554 | to the proper pointer type. */
|
---|
555 |
|
---|
556 | #ifdef YYPARSE_PARAM
|
---|
557 | #ifdef __cplusplus
|
---|
558 | #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
|
---|
559 | #define YYPARSE_PARAM_DECL
|
---|
560 | #else /* not __cplusplus */
|
---|
561 | #define YYPARSE_PARAM_ARG YYPARSE_PARAM
|
---|
562 | #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
|
---|
563 | #endif /* not __cplusplus */
|
---|
564 | #else /* not YYPARSE_PARAM */
|
---|
565 | #define YYPARSE_PARAM_ARG
|
---|
566 | #define YYPARSE_PARAM_DECL
|
---|
567 | #endif /* not YYPARSE_PARAM */
|
---|
568 |
|
---|
569 | int
|
---|
570 | yyparse(YYPARSE_PARAM_ARG)
|
---|
571 | YYPARSE_PARAM_DECL
|
---|
572 | {
|
---|
573 | register int yystate;
|
---|
574 | register int yyn;
|
---|
575 | register short *yyssp;
|
---|
576 | register YYSTYPE *yyvsp;
|
---|
577 | int yyerrstatus; /* number of tokens to shift before error messages enabled */
|
---|
578 | int yychar1 = 0; /* lookahead token as an internal (translated) token number */
|
---|
579 |
|
---|
580 | short yyssa[YYINITDEPTH]; /* the state stack */
|
---|
581 | YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
|
---|
582 |
|
---|
583 | short *yyss = yyssa; /* refer to the stacks thru separate pointers */
|
---|
584 | YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
|
---|
585 |
|
---|
586 | #ifdef YYLSP_NEEDED
|
---|
587 | YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
|
---|
588 | YYLTYPE *yyls = yylsa;
|
---|
589 | YYLTYPE *yylsp;
|
---|
590 |
|
---|
591 | #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
|
---|
592 | #else
|
---|
593 | #define YYPOPSTACK (yyvsp--, yyssp--)
|
---|
594 | #endif
|
---|
595 |
|
---|
596 | int yystacksize = YYINITDEPTH;
|
---|
597 |
|
---|
598 | #ifdef YYPURE
|
---|
599 | int yychar;
|
---|
600 | YYSTYPE yylval;
|
---|
601 | int yynerrs;
|
---|
602 | #ifdef YYLSP_NEEDED
|
---|
603 | YYLTYPE yylloc;
|
---|
604 | #endif
|
---|
605 | #endif
|
---|
606 |
|
---|
607 | YYSTYPE yyval; /* the variable used to return */
|
---|
608 | /* semantic values from the action */
|
---|
609 | /* routines */
|
---|
610 |
|
---|
611 | int yylen;
|
---|
612 |
|
---|
613 | #if YYDEBUG != 0
|
---|
614 | if (yydebug)
|
---|
615 | fprintf(stderr, "Starting parse\n");
|
---|
616 | #endif
|
---|
617 |
|
---|
618 | yystate = 0;
|
---|
619 | yyerrstatus = 0;
|
---|
620 | yynerrs = 0;
|
---|
621 | yychar = YYEMPTY; /* Cause a token to be read. */
|
---|
622 |
|
---|
623 | /* Initialize stack pointers.
|
---|
624 | Waste one element of value and location stack
|
---|
625 | so that they stay on the same level as the state stack.
|
---|
626 | The wasted elements are never initialized. */
|
---|
627 |
|
---|
628 | yyssp = yyss - 1;
|
---|
629 | yyvsp = yyvs;
|
---|
630 | #ifdef YYLSP_NEEDED
|
---|
631 | yylsp = yyls;
|
---|
632 | #endif
|
---|
633 |
|
---|
634 | /* Push a new state, which is found in yystate . */
|
---|
635 | /* In all cases, when you get here, the value and location stacks
|
---|
636 | have just been pushed. so pushing a state here evens the stacks. */
|
---|
637 | yynewstate:
|
---|
638 |
|
---|
639 | *++yyssp = yystate;
|
---|
640 |
|
---|
641 | if (yyssp >= yyss + yystacksize - 1)
|
---|
642 | {
|
---|
643 | /* Give user a chance to reallocate the stack */
|
---|
644 | /* Use copies of these so that the &'s don't force the real ones into memory. */
|
---|
645 | YYSTYPE *yyvs1 = yyvs;
|
---|
646 | short *yyss1 = yyss;
|
---|
647 | #ifdef YYLSP_NEEDED
|
---|
648 | YYLTYPE *yyls1 = yyls;
|
---|
649 | #endif
|
---|
650 |
|
---|
651 | /* Get the current used size of the three stacks, in elements. */
|
---|
652 | int size = yyssp - yyss + 1;
|
---|
653 |
|
---|
654 | #ifdef yyoverflow
|
---|
655 | /* Each stack pointer address is followed by the size of
|
---|
656 | the data in use in that stack, in bytes. */
|
---|
657 | #ifdef YYLSP_NEEDED
|
---|
658 | /* This used to be a conditional around just the two extra args,
|
---|
659 | but that might be undefined if yyoverflow is a macro. */
|
---|
660 | yyoverflow("parser stack overflow",
|
---|
661 | &yyss1, size * sizeof (*yyssp),
|
---|
662 | &yyvs1, size * sizeof (*yyvsp),
|
---|
663 | &yyls1, size * sizeof (*yylsp),
|
---|
664 | &yystacksize);
|
---|
665 | #else
|
---|
666 | yyoverflow("parser stack overflow",
|
---|
667 | &yyss1, size * sizeof (*yyssp),
|
---|
668 | &yyvs1, size * sizeof (*yyvsp),
|
---|
669 | &yystacksize);
|
---|
670 | #endif
|
---|
671 |
|
---|
672 | yyss = yyss1; yyvs = yyvs1;
|
---|
673 | #ifdef YYLSP_NEEDED
|
---|
674 | yyls = yyls1;
|
---|
675 | #endif
|
---|
676 | #else /* no yyoverflow */
|
---|
677 | /* Extend the stack our own way. */
|
---|
678 | if (yystacksize >= YYMAXDEPTH)
|
---|
679 | {
|
---|
680 | yyerror("parser stack overflow");
|
---|
681 | return 2;
|
---|
682 | }
|
---|
683 | yystacksize *= 2;
|
---|
684 | if (yystacksize > YYMAXDEPTH)
|
---|
685 | yystacksize = YYMAXDEPTH;
|
---|
686 | yyss = (short *) alloca (yystacksize * sizeof (*yyssp));
|
---|
687 | __yy_memcpy ((char *)yyss, (char *)yyss1, size * sizeof (*yyssp));
|
---|
688 | yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp));
|
---|
689 | __yy_memcpy ((char *)yyvs, (char *)yyvs1, size * sizeof (*yyvsp));
|
---|
690 | #ifdef YYLSP_NEEDED
|
---|
691 | yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp));
|
---|
692 | __yy_memcpy ((char *)yyls, (char *)yyls1, size * sizeof (*yylsp));
|
---|
693 | #endif
|
---|
694 | #endif /* no yyoverflow */
|
---|
695 |
|
---|
696 | yyssp = yyss + size - 1;
|
---|
697 | yyvsp = yyvs + size - 1;
|
---|
698 | #ifdef YYLSP_NEEDED
|
---|
699 | yylsp = yyls + size - 1;
|
---|
700 | #endif
|
---|
701 |
|
---|
702 | #if YYDEBUG != 0
|
---|
703 | if (yydebug)
|
---|
704 | fprintf(stderr, "Stack size increased to %d\n", yystacksize);
|
---|
705 | #endif
|
---|
706 |
|
---|
707 | if (yyssp >= yyss + yystacksize - 1)
|
---|
708 | YYABORT;
|
---|
709 | }
|
---|
710 |
|
---|
711 | #if YYDEBUG != 0
|
---|
712 | if (yydebug)
|
---|
713 | fprintf(stderr, "Entering state %d\n", yystate);
|
---|
714 | #endif
|
---|
715 |
|
---|
716 | goto yybackup;
|
---|
717 | yybackup:
|
---|
718 |
|
---|
719 | /* Do appropriate processing given the current state. */
|
---|
720 | /* Read a lookahead token if we need one and don't already have one. */
|
---|
721 | /* yyresume: */
|
---|
722 |
|
---|
723 | /* First try to decide what to do without reference to lookahead token. */
|
---|
724 |
|
---|
725 | yyn = yypact[yystate];
|
---|
726 | if (yyn == YYFLAG)
|
---|
727 | goto yydefault;
|
---|
728 |
|
---|
729 | /* Not known => get a lookahead token if don't already have one. */
|
---|
730 |
|
---|
731 | /* yychar is either YYEMPTY or YYEOF
|
---|
732 | or a valid token in external form. */
|
---|
733 |
|
---|
734 | if (yychar == YYEMPTY)
|
---|
735 | {
|
---|
736 | #if YYDEBUG != 0
|
---|
737 | if (yydebug)
|
---|
738 | fprintf(stderr, "Reading a token: ");
|
---|
739 | #endif
|
---|
740 | yychar = YYLEX;
|
---|
741 | }
|
---|
742 |
|
---|
743 | /* Convert token to internal form (in yychar1) for indexing tables with */
|
---|
744 |
|
---|
745 | if (yychar <= 0) /* This means end of input. */
|
---|
746 | {
|
---|
747 | yychar1 = 0;
|
---|
748 | yychar = YYEOF; /* Don't call YYLEX any more */
|
---|
749 |
|
---|
750 | #if YYDEBUG != 0
|
---|
751 | if (yydebug)
|
---|
752 | fprintf(stderr, "Now at end of input.\n");
|
---|
753 | #endif
|
---|
754 | }
|
---|
755 | else
|
---|
756 | {
|
---|
757 | yychar1 = YYTRANSLATE(yychar);
|
---|
758 |
|
---|
759 | #if YYDEBUG != 0
|
---|
760 | if (yydebug)
|
---|
761 | {
|
---|
762 | fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
|
---|
763 | /* Give the individual parser a way to print the precise meaning
|
---|
764 | of a token, for further debugging info. */
|
---|
765 | #ifdef YYPRINT
|
---|
766 | YYPRINT (stderr, yychar, yylval);
|
---|
767 | #endif
|
---|
768 | fprintf (stderr, ")\n");
|
---|
769 | }
|
---|
770 | #endif
|
---|
771 | }
|
---|
772 |
|
---|
773 | yyn += yychar1;
|
---|
774 | if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
|
---|
775 | goto yydefault;
|
---|
776 |
|
---|
777 | yyn = yytable[yyn];
|
---|
778 |
|
---|
779 | /* yyn is what to do for this token type in this state.
|
---|
780 | Negative => reduce, -yyn is rule number.
|
---|
781 | Positive => shift, yyn is new state.
|
---|
782 | New state is final state => don't bother to shift,
|
---|
783 | just return success.
|
---|
784 | 0, or most negative number => error. */
|
---|
785 |
|
---|
786 | if (yyn < 0)
|
---|
787 | {
|
---|
788 | if (yyn == YYFLAG)
|
---|
789 | goto yyerrlab;
|
---|
790 | yyn = -yyn;
|
---|
791 | goto yyreduce;
|
---|
792 | }
|
---|
793 | else if (yyn == 0)
|
---|
794 | goto yyerrlab;
|
---|
795 |
|
---|
796 | if (yyn == YYFINAL)
|
---|
797 | YYACCEPT;
|
---|
798 |
|
---|
799 | /* Shift the lookahead token. */
|
---|
800 |
|
---|
801 | #if YYDEBUG != 0
|
---|
802 | if (yydebug)
|
---|
803 | fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
|
---|
804 | #endif
|
---|
805 |
|
---|
806 | /* Discard the token being shifted unless it is eof. */
|
---|
807 | if (yychar != YYEOF)
|
---|
808 | yychar = YYEMPTY;
|
---|
809 |
|
---|
810 | *++yyvsp = yylval;
|
---|
811 | #ifdef YYLSP_NEEDED
|
---|
812 | *++yylsp = yylloc;
|
---|
813 | #endif
|
---|
814 |
|
---|
815 | /* count tokens shifted since error; after three, turn off error status. */
|
---|
816 | if (yyerrstatus) yyerrstatus--;
|
---|
817 |
|
---|
818 | yystate = yyn;
|
---|
819 | goto yynewstate;
|
---|
820 |
|
---|
821 | /* Do the default action for the current state. */
|
---|
822 | yydefault:
|
---|
823 |
|
---|
824 | yyn = yydefact[yystate];
|
---|
825 | if (yyn == 0)
|
---|
826 | goto yyerrlab;
|
---|
827 |
|
---|
828 | /* Do a reduction. yyn is the number of a rule to reduce with. */
|
---|
829 | yyreduce:
|
---|
830 | yylen = yyr2[yyn];
|
---|
831 | if (yylen > 0)
|
---|
832 | yyval = yyvsp[1-yylen]; /* implement default value of the action */
|
---|
833 |
|
---|
834 | #if YYDEBUG != 0
|
---|
835 | if (yydebug)
|
---|
836 | {
|
---|
837 | int i;
|
---|
838 |
|
---|
839 | fprintf (stderr, "Reducing via rule %d (line %d), ",
|
---|
840 | yyn, yyrline[yyn]);
|
---|
841 |
|
---|
842 | /* Print the symbols being reduced, and their result. */
|
---|
843 | for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
|
---|
844 | fprintf (stderr, "%s ", yytname[yyrhs[i]]);
|
---|
845 | fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
|
---|
846 | }
|
---|
847 | #endif
|
---|
848 |
|
---|
849 |
|
---|
850 | switch (yyn) {
|
---|
851 |
|
---|
852 | case 1:
|
---|
853 |
|
---|
854 | {
|
---|
855 | if(!check_languages(nodehead))
|
---|
856 | xyyerror("No messages defined");
|
---|
857 | lanblockhead = block_messages(nodehead);
|
---|
858 | ;
|
---|
859 | break;}
|
---|
860 | case 5:
|
---|
861 |
|
---|
862 | { add_node(nd_msg, yyvsp[0].msg); ;
|
---|
863 | break;}
|
---|
864 | case 6:
|
---|
865 |
|
---|
866 | { add_node(nd_comment, yyvsp[0].str); ;
|
---|
867 | break;}
|
---|
868 | case 7:
|
---|
869 |
|
---|
870 | { xyyerror(err_syntax); /* `Catch all' error */ ;
|
---|
871 | break;}
|
---|
872 | case 9:
|
---|
873 |
|
---|
874 | { xyyerror(err_pclose); ;
|
---|
875 | break;}
|
---|
876 | case 10:
|
---|
877 |
|
---|
878 | { xyyerror(err_popen); ;
|
---|
879 | break;}
|
---|
880 | case 11:
|
---|
881 |
|
---|
882 | { xyyerror(err_assign); ;
|
---|
883 | break;}
|
---|
884 | case 13:
|
---|
885 |
|
---|
886 | { xyyerror(err_pclose); ;
|
---|
887 | break;}
|
---|
888 | case 14:
|
---|
889 |
|
---|
890 | { xyyerror(err_popen); ;
|
---|
891 | break;}
|
---|
892 | case 15:
|
---|
893 |
|
---|
894 | { xyyerror(err_assign); ;
|
---|
895 | break;}
|
---|
896 | case 17:
|
---|
897 |
|
---|
898 | { xyyerror(err_pclose); ;
|
---|
899 | break;}
|
---|
900 | case 18:
|
---|
901 |
|
---|
902 | { xyyerror(err_popen); ;
|
---|
903 | break;}
|
---|
904 | case 19:
|
---|
905 |
|
---|
906 | { xyyerror(err_assign); ;
|
---|
907 | break;}
|
---|
908 | case 21:
|
---|
909 |
|
---|
910 | { xyyerror(err_pclose); ;
|
---|
911 | break;}
|
---|
912 | case 22:
|
---|
913 |
|
---|
914 | { xyyerror(err_popen); ;
|
---|
915 | break;}
|
---|
916 | case 23:
|
---|
917 |
|
---|
918 | { xyyerror(err_assign); ;
|
---|
919 | break;}
|
---|
920 | case 24:
|
---|
921 |
|
---|
922 | { cast = yyvsp[0].str; ;
|
---|
923 | break;}
|
---|
924 | case 25:
|
---|
925 |
|
---|
926 | { xyyerror(err_number); ;
|
---|
927 | break;}
|
---|
928 | case 26:
|
---|
929 |
|
---|
930 | { xyyerror(err_assign); ;
|
---|
931 | break;}
|
---|
932 | case 27:
|
---|
933 |
|
---|
934 | {
|
---|
935 | switch(base)
|
---|
936 | {
|
---|
937 | case 8:
|
---|
938 | case 10:
|
---|
939 | case 16:
|
---|
940 | base = yyvsp[0].num;
|
---|
941 | break;
|
---|
942 | default:
|
---|
943 | xyyerror("Numberbase must be 8, 10 or 16");
|
---|
944 | }
|
---|
945 | ;
|
---|
946 | break;}
|
---|
947 | case 28:
|
---|
948 |
|
---|
949 | { xyyerror(err_number); ;
|
---|
950 | break;}
|
---|
951 | case 29:
|
---|
952 |
|
---|
953 | { xyyerror(err_assign); ;
|
---|
954 | break;}
|
---|
955 | case 32:
|
---|
956 |
|
---|
957 | { xyyerror(err_ident); ;
|
---|
958 | break;}
|
---|
959 | case 33:
|
---|
960 |
|
---|
961 | {
|
---|
962 | yyvsp[-3].tok->token = yyvsp[-1].num;
|
---|
963 | yyvsp[-3].tok->alias = yyvsp[0].str;
|
---|
964 | if(yyvsp[-1].num & (~0x3))
|
---|
965 | xyyerror("Severity value out of range (0x%08x > 0x3)", yyvsp[-1].num);
|
---|
966 | do_add_token(tok_severity, yyvsp[-3].tok, (const char*)"severity");
|
---|
967 | ;
|
---|
968 | break;}
|
---|
969 | case 34:
|
---|
970 |
|
---|
971 | { xyyerror(err_number); ;
|
---|
972 | break;}
|
---|
973 | case 35:
|
---|
974 |
|
---|
975 | { xyyerror(err_assign); ;
|
---|
976 | break;}
|
---|
977 | case 38:
|
---|
978 |
|
---|
979 | { xyyerror(err_ident); ;
|
---|
980 | break;}
|
---|
981 | case 39:
|
---|
982 |
|
---|
983 | {
|
---|
984 | yyvsp[-3].tok->token = yyvsp[-1].num;
|
---|
985 | yyvsp[-3].tok->alias = yyvsp[0].str;
|
---|
986 | if(yyvsp[-1].num & (~0xfff))
|
---|
987 | xyyerror("Facility value out of range (0x%08x > 0xfff)", yyvsp[-1].num);
|
---|
988 | do_add_token(tok_facility, yyvsp[-3].tok, (const char*)"facility");
|
---|
989 | ;
|
---|
990 | break;}
|
---|
991 | case 40:
|
---|
992 |
|
---|
993 | { xyyerror(err_number); ;
|
---|
994 | break;}
|
---|
995 | case 41:
|
---|
996 |
|
---|
997 | { xyyerror(err_assign); ;
|
---|
998 | break;}
|
---|
999 | case 42:
|
---|
1000 |
|
---|
1001 | { yyval.str = NULL; ;
|
---|
1002 | break;}
|
---|
1003 | case 43:
|
---|
1004 |
|
---|
1005 | { yyval.str = yyvsp[0].str; ;
|
---|
1006 | break;}
|
---|
1007 | case 44:
|
---|
1008 |
|
---|
1009 | { xyyerror(err_ident); ;
|
---|
1010 | break;}
|
---|
1011 | case 47:
|
---|
1012 |
|
---|
1013 | { xyyerror(err_ident); ;
|
---|
1014 | break;}
|
---|
1015 | case 48:
|
---|
1016 |
|
---|
1017 | {
|
---|
1018 | yyvsp[-6].tok->token = yyvsp[-4].num;
|
---|
1019 | yyvsp[-6].tok->alias = yyvsp[-1].str;
|
---|
1020 | yyvsp[-6].tok->codepage = yyvsp[0].num;
|
---|
1021 | do_add_token(tok_language, yyvsp[-6].tok, (const char*)"language");
|
---|
1022 | if(!find_language(yyvsp[-4].num) && !find_cpxlat(yyvsp[-4].num))
|
---|
1023 | yywarning("Language 0x%x not built-in, using codepage %d; use explicit codepage to override", yyvsp[-4].num, WMC_DEFAULT_CODEPAGE);
|
---|
1024 | ;
|
---|
1025 | break;}
|
---|
1026 | case 49:
|
---|
1027 |
|
---|
1028 | { xyyerror("Filename expected"); ;
|
---|
1029 | break;}
|
---|
1030 | case 50:
|
---|
1031 |
|
---|
1032 | { xyyerror(err_colon); ;
|
---|
1033 | break;}
|
---|
1034 | case 51:
|
---|
1035 |
|
---|
1036 | { xyyerror(err_number); ;
|
---|
1037 | break;}
|
---|
1038 | case 52:
|
---|
1039 |
|
---|
1040 | { xyyerror(err_assign); ;
|
---|
1041 | break;}
|
---|
1042 | case 53:
|
---|
1043 |
|
---|
1044 | { yyval.num = 0; ;
|
---|
1045 | break;}
|
---|
1046 | case 54:
|
---|
1047 |
|
---|
1048 | { yyval.num = yyvsp[0].num; ;
|
---|
1049 | break;}
|
---|
1050 | case 55:
|
---|
1051 |
|
---|
1052 | { xyyerror("Codepage-number expected"); ;
|
---|
1053 | break;}
|
---|
1054 | case 58:
|
---|
1055 |
|
---|
1056 | { xyyerror(err_ident); ;
|
---|
1057 | break;}
|
---|
1058 | case 59:
|
---|
1059 |
|
---|
1060 | {
|
---|
1061 | static const char err_nocp[] = "Codepage %d not builtin; cannot convert";
|
---|
1062 | if(find_cpxlat(yyvsp[-4].num))
|
---|
1063 | xyyerror("Codepage translation already defined for language 0x%x", yyvsp[-4].num);
|
---|
1064 | if(yyvsp[-2].num && !find_codepage(yyvsp[-2].num))
|
---|
1065 | xyyerror(err_nocp, yyvsp[-2].num);
|
---|
1066 | if(yyvsp[0].num && !find_codepage(yyvsp[0].num))
|
---|
1067 | xyyerror(err_nocp, yyvsp[0].num);
|
---|
1068 | add_cpxlat(yyvsp[-4].num, yyvsp[-2].num, yyvsp[0].num);
|
---|
1069 | ;
|
---|
1070 | break;}
|
---|
1071 | case 60:
|
---|
1072 |
|
---|
1073 | { xyyerror(err_number); ;
|
---|
1074 | break;}
|
---|
1075 | case 61:
|
---|
1076 |
|
---|
1077 | { xyyerror(err_colon); ;
|
---|
1078 | break;}
|
---|
1079 | case 62:
|
---|
1080 |
|
---|
1081 | { xyyerror(err_number); ;
|
---|
1082 | break;}
|
---|
1083 | case 63:
|
---|
1084 |
|
---|
1085 | { xyyerror(err_assign); ;
|
---|
1086 | break;}
|
---|
1087 | case 64:
|
---|
1088 |
|
---|
1089 | { yyval.num = yyvsp[0].num; ;
|
---|
1090 | break;}
|
---|
1091 | case 65:
|
---|
1092 |
|
---|
1093 | {
|
---|
1094 | if(yyvsp[0].tok->type != tok_language)
|
---|
1095 | xyyerror("Language name or code expected");
|
---|
1096 | yyval.num = yyvsp[0].tok->token;
|
---|
1097 | ;
|
---|
1098 | break;}
|
---|
1099 | case 66:
|
---|
1100 |
|
---|
1101 | { test_id(yyvsp[-1].num); ;
|
---|
1102 | break;}
|
---|
1103 | case 67:
|
---|
1104 |
|
---|
1105 | { yyval.msg = complete_msg(yyvsp[0].msg, yyvsp[-3].num); ;
|
---|
1106 | break;}
|
---|
1107 | case 68:
|
---|
1108 |
|
---|
1109 | {
|
---|
1110 | if(yyvsp[0].num & (~0xffff))
|
---|
1111 | xyyerror("Message ID value out of range (0x%08x > 0xffff)", yyvsp[0].num);
|
---|
1112 | yyval.num = yyvsp[0].num;
|
---|
1113 | ;
|
---|
1114 | break;}
|
---|
1115 | case 69:
|
---|
1116 |
|
---|
1117 | { xyyerror(err_assign); ;
|
---|
1118 | break;}
|
---|
1119 | case 70:
|
---|
1120 |
|
---|
1121 | { yyval.num = ++last_id; ;
|
---|
1122 | break;}
|
---|
1123 | case 71:
|
---|
1124 |
|
---|
1125 | { yyval.num = last_id = yyvsp[0].num; ;
|
---|
1126 | break;}
|
---|
1127 | case 72:
|
---|
1128 |
|
---|
1129 | { yyval.num = last_id += yyvsp[0].num; ;
|
---|
1130 | break;}
|
---|
1131 | case 73:
|
---|
1132 |
|
---|
1133 | { xyyerror(err_number); ;
|
---|
1134 | break;}
|
---|
1135 | case 74:
|
---|
1136 |
|
---|
1137 | { have_sev = have_fac = have_sym = 0; ;
|
---|
1138 | break;}
|
---|
1139 | case 75:
|
---|
1140 |
|
---|
1141 | { if(have_sev) xyyerror("Severity already defined"); have_sev = 1; ;
|
---|
1142 | break;}
|
---|
1143 | case 76:
|
---|
1144 |
|
---|
1145 | { if(have_fac) xyyerror("Facility already defined"); have_fac = 1; ;
|
---|
1146 | break;}
|
---|
1147 | case 77:
|
---|
1148 |
|
---|
1149 | { if(have_sym) xyyerror("Symbolname already defined"); have_sym = 1; ;
|
---|
1150 | break;}
|
---|
1151 | case 78:
|
---|
1152 |
|
---|
1153 | { last_sym = yyvsp[0].str; ;
|
---|
1154 | break;}
|
---|
1155 | case 79:
|
---|
1156 |
|
---|
1157 | { xyyerror(err_ident); ;
|
---|
1158 | break;}
|
---|
1159 | case 80:
|
---|
1160 |
|
---|
1161 | { xyyerror(err_assign); ;
|
---|
1162 | break;}
|
---|
1163 | case 81:
|
---|
1164 |
|
---|
1165 | {
|
---|
1166 | token_t *tok = lookup_token(yyvsp[0].tok->name);
|
---|
1167 | if(!tok)
|
---|
1168 | xyyerror("Undefined severityname");
|
---|
1169 | if(tok->type != tok_severity)
|
---|
1170 | xyyerror("Identifier is not of class 'severity'");
|
---|
1171 | last_sev = tok->token;
|
---|
1172 | ;
|
---|
1173 | break;}
|
---|
1174 | case 82:
|
---|
1175 |
|
---|
1176 | { xyyerror(err_ident); ;
|
---|
1177 | break;}
|
---|
1178 | case 83:
|
---|
1179 |
|
---|
1180 | { xyyerror(err_assign); ;
|
---|
1181 | break;}
|
---|
1182 | case 84:
|
---|
1183 |
|
---|
1184 | {
|
---|
1185 | token_t *tok = lookup_token(yyvsp[0].tok->name);
|
---|
1186 | if(!tok)
|
---|
1187 | xyyerror("Undefined facilityname");
|
---|
1188 | if(tok->type != tok_facility)
|
---|
1189 | xyyerror("Identifier is not of class 'facility'");
|
---|
1190 | last_fac = tok->token;
|
---|
1191 | ;
|
---|
1192 | break;}
|
---|
1193 | case 85:
|
---|
1194 |
|
---|
1195 | { xyyerror(err_ident); ;
|
---|
1196 | break;}
|
---|
1197 | case 86:
|
---|
1198 |
|
---|
1199 | { xyyerror(err_assign); ;
|
---|
1200 | break;}
|
---|
1201 | case 87:
|
---|
1202 |
|
---|
1203 | { yyval.msg = add_lanmsg(NULL, yyvsp[0].lmp); ;
|
---|
1204 | break;}
|
---|
1205 | case 88:
|
---|
1206 |
|
---|
1207 | { yyval.msg = add_lanmsg(yyvsp[-1].msg, yyvsp[0].lmp); ;
|
---|
1208 | break;}
|
---|
1209 | case 89:
|
---|
1210 |
|
---|
1211 | { xyyerror("'Language=...' (start of message text-definition) expected"); ;
|
---|
1212 | break;}
|
---|
1213 | case 90:
|
---|
1214 |
|
---|
1215 | { yyval.lmp = new_lanmsg(&yyvsp[-3].lcp, yyvsp[-1].str); ;
|
---|
1216 | break;}
|
---|
1217 | case 91:
|
---|
1218 | {
|
---|
1219 | token_t *tok = lookup_token(yyvsp[-1].tok->name);
|
---|
1220 | cp_xlat_t *cpx;
|
---|
1221 | if(!tok)
|
---|
1222 | xyyerror("Undefined language");
|
---|
1223 | if(tok->type != tok_language)
|
---|
1224 | xyyerror("Identifier is not of class 'language'");
|
---|
1225 | if((cpx = find_cpxlat(tok->token)))
|
---|
1226 | {
|
---|
1227 | set_codepage(yyval.lcp.codepage = cpx->cpin);
|
---|
1228 | }
|
---|
1229 | else if(!tok->codepage)
|
---|
1230 | {
|
---|
1231 | const language_t *lan = find_language(tok->token);
|
---|
1232 | if(!lan)
|
---|
1233 | {
|
---|
1234 | /* Just set default; warning was given while parsing languagenames */
|
---|
1235 | set_codepage(yyval.lcp.codepage = WMC_DEFAULT_CODEPAGE);
|
---|
1236 | }
|
---|
1237 | else
|
---|
1238 | {
|
---|
1239 | /* The default seems to be to use the DOS codepage... */
|
---|
1240 | set_codepage(yyval.lcp.codepage = lan->doscp);
|
---|
1241 | }
|
---|
1242 | }
|
---|
1243 | else
|
---|
1244 | set_codepage(yyval.lcp.codepage = tok->codepage);
|
---|
1245 | yyval.lcp.language = tok->token;
|
---|
1246 | ;
|
---|
1247 | break;}
|
---|
1248 | case 92:
|
---|
1249 |
|
---|
1250 | { xyyerror("Missing newline"); ;
|
---|
1251 | break;}
|
---|
1252 | case 93:
|
---|
1253 |
|
---|
1254 | { xyyerror(err_ident); ;
|
---|
1255 | break;}
|
---|
1256 | case 94:
|
---|
1257 |
|
---|
1258 | { xyyerror(err_assign); ;
|
---|
1259 | break;}
|
---|
1260 | case 95:
|
---|
1261 |
|
---|
1262 | { yyval.str = yyvsp[0].str; ;
|
---|
1263 | break;}
|
---|
1264 | case 96:
|
---|
1265 |
|
---|
1266 | { yyval.str = merge(yyvsp[-1].str, yyvsp[0].str); ;
|
---|
1267 | break;}
|
---|
1268 | case 97:
|
---|
1269 |
|
---|
1270 | { xyyerror(err_msg); ;
|
---|
1271 | break;}
|
---|
1272 | case 98:
|
---|
1273 |
|
---|
1274 | { xyyerror(err_msg); ;
|
---|
1275 | break;}
|
---|
1276 | case 99:
|
---|
1277 |
|
---|
1278 | { yyval.tok = xmalloc(sizeof(token_t)); yyval.tok->name = yyvsp[0].str; ;
|
---|
1279 | break;}
|
---|
1280 | case 100:
|
---|
1281 |
|
---|
1282 | { yyval.tok = yyvsp[0].tok; ;
|
---|
1283 | break;}
|
---|
1284 | case 101:
|
---|
1285 |
|
---|
1286 | { want_nl = 1; ;
|
---|
1287 | break;}
|
---|
1288 | case 102:
|
---|
1289 |
|
---|
1290 | { want_line = 1; ;
|
---|
1291 | break;}
|
---|
1292 | case 103:
|
---|
1293 |
|
---|
1294 | { want_file = 1; ;
|
---|
1295 | break;}
|
---|
1296 | }
|
---|
1297 | /* the action file gets copied in in place of this dollarsign */
|
---|
1298 |
|
---|
1299 | |
---|
1300 |
|
---|
1301 | yyvsp -= yylen;
|
---|
1302 | yyssp -= yylen;
|
---|
1303 | #ifdef YYLSP_NEEDED
|
---|
1304 | yylsp -= yylen;
|
---|
1305 | #endif
|
---|
1306 |
|
---|
1307 | #if YYDEBUG != 0
|
---|
1308 | if (yydebug)
|
---|
1309 | {
|
---|
1310 | short *ssp1 = yyss - 1;
|
---|
1311 | fprintf (stderr, "state stack now");
|
---|
1312 | while (ssp1 != yyssp)
|
---|
1313 | fprintf (stderr, " %d", *++ssp1);
|
---|
1314 | fprintf (stderr, "\n");
|
---|
1315 | }
|
---|
1316 | #endif
|
---|
1317 |
|
---|
1318 | *++yyvsp = yyval;
|
---|
1319 |
|
---|
1320 | #ifdef YYLSP_NEEDED
|
---|
1321 | yylsp++;
|
---|
1322 | if (yylen == 0)
|
---|
1323 | {
|
---|
1324 | yylsp->first_line = yylloc.first_line;
|
---|
1325 | yylsp->first_column = yylloc.first_column;
|
---|
1326 | yylsp->last_line = (yylsp-1)->last_line;
|
---|
1327 | yylsp->last_column = (yylsp-1)->last_column;
|
---|
1328 | yylsp->text = 0;
|
---|
1329 | }
|
---|
1330 | else
|
---|
1331 | {
|
---|
1332 | yylsp->last_line = (yylsp+yylen-1)->last_line;
|
---|
1333 | yylsp->last_column = (yylsp+yylen-1)->last_column;
|
---|
1334 | }
|
---|
1335 | #endif
|
---|
1336 |
|
---|
1337 | /* Now "shift" the result of the reduction.
|
---|
1338 | Determine what state that goes to,
|
---|
1339 | based on the state we popped back to
|
---|
1340 | and the rule number reduced by. */
|
---|
1341 |
|
---|
1342 | yyn = yyr1[yyn];
|
---|
1343 |
|
---|
1344 | yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
|
---|
1345 | if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
|
---|
1346 | yystate = yytable[yystate];
|
---|
1347 | else
|
---|
1348 | yystate = yydefgoto[yyn - YYNTBASE];
|
---|
1349 |
|
---|
1350 | goto yynewstate;
|
---|
1351 |
|
---|
1352 | yyerrlab: /* here on detecting error */
|
---|
1353 |
|
---|
1354 | if (! yyerrstatus)
|
---|
1355 | /* If not already recovering from an error, report this error. */
|
---|
1356 | {
|
---|
1357 | ++yynerrs;
|
---|
1358 |
|
---|
1359 | #ifdef YYERROR_VERBOSE
|
---|
1360 | yyn = yypact[yystate];
|
---|
1361 |
|
---|
1362 | if (yyn > YYFLAG && yyn < YYLAST)
|
---|
1363 | {
|
---|
1364 | int size = 0;
|
---|
1365 | char *msg;
|
---|
1366 | int x, count;
|
---|
1367 |
|
---|
1368 | count = 0;
|
---|
1369 | /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
|
---|
1370 | for (x = (yyn < 0 ? -yyn : 0);
|
---|
1371 | x < (sizeof(yytname) / sizeof(char *)); x++)
|
---|
1372 | if (yycheck[x + yyn] == x)
|
---|
1373 | size += strlen(yytname[x]) + 15, count++;
|
---|
1374 | msg = (char *) malloc(size + 15);
|
---|
1375 | if (msg != 0)
|
---|
1376 | {
|
---|
1377 | strcpy(msg, "parse error");
|
---|
1378 |
|
---|
1379 | if (count < 5)
|
---|
1380 | {
|
---|
1381 | count = 0;
|
---|
1382 | for (x = (yyn < 0 ? -yyn : 0);
|
---|
1383 | x < (sizeof(yytname) / sizeof(char *)); x++)
|
---|
1384 | if (yycheck[x + yyn] == x)
|
---|
1385 | {
|
---|
1386 | strcat(msg, count == 0 ? ", expecting `" : " or `");
|
---|
1387 | strcat(msg, yytname[x]);
|
---|
1388 | strcat(msg, "'");
|
---|
1389 | count++;
|
---|
1390 | }
|
---|
1391 | }
|
---|
1392 | yyerror(msg);
|
---|
1393 | free(msg);
|
---|
1394 | }
|
---|
1395 | else
|
---|
1396 | yyerror ("parse error; also virtual memory exceeded");
|
---|
1397 | }
|
---|
1398 | else
|
---|
1399 | #endif /* YYERROR_VERBOSE */
|
---|
1400 | yyerror("parse error");
|
---|
1401 | }
|
---|
1402 |
|
---|
1403 | goto yyerrlab1;
|
---|
1404 | yyerrlab1: /* here on error raised explicitly by an action */
|
---|
1405 |
|
---|
1406 | if (yyerrstatus == 3)
|
---|
1407 | {
|
---|
1408 | /* if just tried and failed to reuse lookahead token after an error, discard it. */
|
---|
1409 |
|
---|
1410 | /* return failure if at end of input */
|
---|
1411 | if (yychar == YYEOF)
|
---|
1412 | YYABORT;
|
---|
1413 |
|
---|
1414 | #if YYDEBUG != 0
|
---|
1415 | if (yydebug)
|
---|
1416 | fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
|
---|
1417 | #endif
|
---|
1418 |
|
---|
1419 | yychar = YYEMPTY;
|
---|
1420 | }
|
---|
1421 |
|
---|
1422 | /* Else will try to reuse lookahead token
|
---|
1423 | after shifting the error token. */
|
---|
1424 |
|
---|
1425 | yyerrstatus = 3; /* Each real token shifted decrements this */
|
---|
1426 |
|
---|
1427 | goto yyerrhandle;
|
---|
1428 |
|
---|
1429 | yyerrdefault: /* current state does not do anything special for the error token. */
|
---|
1430 |
|
---|
1431 | #if 0
|
---|
1432 | /* This is wrong; only states that explicitly want error tokens
|
---|
1433 | should shift them. */
|
---|
1434 | yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
|
---|
1435 | if (yyn) goto yydefault;
|
---|
1436 | #endif
|
---|
1437 |
|
---|
1438 | yyerrpop: /* pop the current state because it cannot handle the error token */
|
---|
1439 |
|
---|
1440 | if (yyssp == yyss) YYABORT;
|
---|
1441 | yyvsp--;
|
---|
1442 | yystate = *--yyssp;
|
---|
1443 | #ifdef YYLSP_NEEDED
|
---|
1444 | yylsp--;
|
---|
1445 | #endif
|
---|
1446 |
|
---|
1447 | #if YYDEBUG != 0
|
---|
1448 | if (yydebug)
|
---|
1449 | {
|
---|
1450 | short *ssp1 = yyss - 1;
|
---|
1451 | fprintf (stderr, "Error: state stack now");
|
---|
1452 | while (ssp1 != yyssp)
|
---|
1453 | fprintf (stderr, " %d", *++ssp1);
|
---|
1454 | fprintf (stderr, "\n");
|
---|
1455 | }
|
---|
1456 | #endif
|
---|
1457 |
|
---|
1458 | yyerrhandle:
|
---|
1459 |
|
---|
1460 | yyn = yypact[yystate];
|
---|
1461 | if (yyn == YYFLAG)
|
---|
1462 | goto yyerrdefault;
|
---|
1463 |
|
---|
1464 | yyn += YYTERROR;
|
---|
1465 | if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
|
---|
1466 | goto yyerrdefault;
|
---|
1467 |
|
---|
1468 | yyn = yytable[yyn];
|
---|
1469 | if (yyn < 0)
|
---|
1470 | {
|
---|
1471 | if (yyn == YYFLAG)
|
---|
1472 | goto yyerrpop;
|
---|
1473 | yyn = -yyn;
|
---|
1474 | goto yyreduce;
|
---|
1475 | }
|
---|
1476 | else if (yyn == 0)
|
---|
1477 | goto yyerrpop;
|
---|
1478 |
|
---|
1479 | if (yyn == YYFINAL)
|
---|
1480 | YYACCEPT;
|
---|
1481 |
|
---|
1482 | #if YYDEBUG != 0
|
---|
1483 | if (yydebug)
|
---|
1484 | fprintf(stderr, "Shifting error token, ");
|
---|
1485 | #endif
|
---|
1486 |
|
---|
1487 | *++yyvsp = yylval;
|
---|
1488 | #ifdef YYLSP_NEEDED
|
---|
1489 | *++yylsp = yylloc;
|
---|
1490 | #endif
|
---|
1491 |
|
---|
1492 | yystate = yyn;
|
---|
1493 | goto yynewstate;
|
---|
1494 | }
|
---|
1495 |
|
---|
1496 |
|
---|
1497 |
|
---|
1498 | static WCHAR *merge(WCHAR *s1, WCHAR *s2)
|
---|
1499 | {
|
---|
1500 | int l1 = unistrlen(s1);
|
---|
1501 | int l2 = unistrlen(s2);
|
---|
1502 | s1 = xrealloc(s1, (l1 + l2 + 1) * sizeof(*s1));
|
---|
1503 | unistrcpy(s1+l1, s2);
|
---|
1504 | free(s2);
|
---|
1505 | return s1;
|
---|
1506 | }
|
---|
1507 |
|
---|
1508 | static void do_add_token(tok_e type, token_t *tok, const char *code)
|
---|
1509 | {
|
---|
1510 | token_t *tp = lookup_token(tok->name);
|
---|
1511 | if(tp)
|
---|
1512 | {
|
---|
1513 | if(tok->type != type)
|
---|
1514 | yywarning("Type change in token");
|
---|
1515 | if(tp != tok)
|
---|
1516 | xyyerror("Overlapping token not the same");
|
---|
1517 | /* else its already defined and changed */
|
---|
1518 | if(tok->fixed)
|
---|
1519 | xyyerror("Redefinition of %s", code);
|
---|
1520 | tok->fixed = 1;
|
---|
1521 | }
|
---|
1522 | else
|
---|
1523 | {
|
---|
1524 | add_token(type, tok->name, tok->token, tok->codepage, tok->alias, 1);
|
---|
1525 | free(tok);
|
---|
1526 | }
|
---|
1527 | }
|
---|
1528 |
|
---|
1529 | static lanmsg_t *new_lanmsg(lan_cp_t *lcp, WCHAR *msg)
|
---|
1530 | {
|
---|
1531 | lanmsg_t *lmp = (lanmsg_t *)xmalloc(sizeof(lanmsg_t));
|
---|
1532 | lmp->lan = lcp->language;
|
---|
1533 | lmp->cp = lcp->codepage;
|
---|
1534 | lmp->msg = msg;
|
---|
1535 | lmp->len = unistrlen(msg) + 1; /* Include termination */
|
---|
1536 | if(lmp->len > 4096)
|
---|
1537 | yywarning("Message exceptionally long; might be a missing termination");
|
---|
1538 | return lmp;
|
---|
1539 | }
|
---|
1540 |
|
---|
1541 | static msg_t *add_lanmsg(msg_t *msg, lanmsg_t *lanmsg)
|
---|
1542 | {
|
---|
1543 | int i;
|
---|
1544 | if(!msg)
|
---|
1545 | msg = xmalloc(sizeof(msg_t));
|
---|
1546 | msg->msgs = xrealloc(msg->msgs, (msg->nmsgs+1) * sizeof(*(msg->msgs)));
|
---|
1547 | msg->msgs[msg->nmsgs] = lanmsg;
|
---|
1548 | msg->nmsgs++;
|
---|
1549 | for(i = 0; i < msg->nmsgs-1; i++)
|
---|
1550 | {
|
---|
1551 | if(msg->msgs[i]->lan == lanmsg->lan)
|
---|
1552 | xyyerror("Message for language 0x%x already defined", lanmsg->lan);
|
---|
1553 | }
|
---|
1554 | return msg;
|
---|
1555 | }
|
---|
1556 |
|
---|
1557 | static int sort_lanmsg(const void *p1, const void *p2)
|
---|
1558 | {
|
---|
1559 | return (*(lanmsg_t **)p1)->lan - (*(lanmsg_t **)p2)->lan;
|
---|
1560 | }
|
---|
1561 |
|
---|
1562 | static msg_t *complete_msg(msg_t *mp, int id)
|
---|
1563 | {
|
---|
1564 | assert(mp != NULL);
|
---|
1565 | mp->id = id;
|
---|
1566 | if(have_sym)
|
---|
1567 | mp->sym = last_sym;
|
---|
1568 | else
|
---|
1569 | xyyerror("No symbolic name defined for message id %d", id);
|
---|
1570 | mp->sev = last_sev;
|
---|
1571 | mp->fac = last_fac;
|
---|
1572 | qsort(mp->msgs, mp->nmsgs, sizeof(*(mp->msgs)), sort_lanmsg);
|
---|
1573 | mp->realid = id | (last_sev << 30) | (last_fac << 16);
|
---|
1574 | if(custombit)
|
---|
1575 | mp->realid |= 1 << 29;
|
---|
1576 | mp->base = base;
|
---|
1577 | mp->cast = cast;
|
---|
1578 | return mp;
|
---|
1579 | }
|
---|
1580 |
|
---|
1581 | static void add_node(node_e type, void *p)
|
---|
1582 | {
|
---|
1583 | node_t *ndp = (node_t *)xmalloc(sizeof(node_t));
|
---|
1584 | ndp->type = type;
|
---|
1585 | ndp->u.all = p;
|
---|
1586 |
|
---|
1587 | if(nodetail)
|
---|
1588 | {
|
---|
1589 | ndp->prev = nodetail;
|
---|
1590 | nodetail->next = ndp;
|
---|
1591 | nodetail = ndp;
|
---|
1592 | }
|
---|
1593 | else
|
---|
1594 | {
|
---|
1595 | nodehead = nodetail = ndp;
|
---|
1596 | }
|
---|
1597 | }
|
---|
1598 |
|
---|
1599 | static void test_id(int id)
|
---|
1600 | {
|
---|
1601 | node_t *ndp;
|
---|
1602 | for(ndp = nodehead; ndp; ndp = ndp->next)
|
---|
1603 | {
|
---|
1604 | if(ndp->type != nd_msg)
|
---|
1605 | continue;
|
---|
1606 | if(ndp->u.msg->id == id && ndp->u.msg->sev == last_sev && ndp->u.msg->fac == last_fac)
|
---|
1607 | xyyerror("MessageId %d with facility 0x%x and severity 0x%x already defined", id, last_fac, last_sev);
|
---|
1608 | }
|
---|
1609 | }
|
---|
1610 |
|
---|
1611 | static int check_languages(node_t *head)
|
---|
1612 | {
|
---|
1613 | static char err_missing[] = "Missing definition for language 0x%x; MessageID %d, facility 0x%x, severity 0x%x";
|
---|
1614 | node_t *ndp;
|
---|
1615 | int nm = 0;
|
---|
1616 | msg_t *msg = NULL;
|
---|
1617 |
|
---|
1618 | for(ndp = head; ndp; ndp = ndp->next)
|
---|
1619 | {
|
---|
1620 | if(ndp->type != nd_msg)
|
---|
1621 | continue;
|
---|
1622 | if(!nm)
|
---|
1623 | {
|
---|
1624 | msg = ndp->u.msg;
|
---|
1625 | }
|
---|
1626 | else
|
---|
1627 | {
|
---|
1628 | int i;
|
---|
1629 | msg_t *m1;
|
---|
1630 | msg_t *m2;
|
---|
1631 | if(ndp->u.msg->nmsgs > msg->nmsgs)
|
---|
1632 | {
|
---|
1633 | m1 = ndp->u.msg;
|
---|
1634 | m2 = msg;
|
---|
1635 | }
|
---|
1636 | else
|
---|
1637 | {
|
---|
1638 | m1 = msg;
|
---|
1639 | m2 = ndp->u.msg;
|
---|
1640 | }
|
---|
1641 |
|
---|
1642 | for(i = 0; i < m1->nmsgs; i++)
|
---|
1643 | {
|
---|
1644 | if(i > m2->nmsgs)
|
---|
1645 | error(err_missing, m1->msgs[i]->lan, m2->id, m2->fac, m2->sev);
|
---|
1646 | else if(m1->msgs[i]->lan < m2->msgs[i]->lan)
|
---|
1647 | error(err_missing, m1->msgs[i]->lan, m2->id, m2->fac, m2->sev);
|
---|
1648 | else if(m1->msgs[i]->lan > m2->msgs[i]->lan)
|
---|
1649 | error(err_missing, m2->msgs[i]->lan, m1->id, m1->fac, m1->sev);
|
---|
1650 | }
|
---|
1651 | }
|
---|
1652 | nm++;
|
---|
1653 | }
|
---|
1654 | return nm;
|
---|
1655 | }
|
---|
1656 |
|
---|
1657 | #define MSGRID(x) ((*(msg_t **)(x))->realid)
|
---|
1658 | static int sort_msg(const void *p1, const void *p2)
|
---|
1659 | {
|
---|
1660 | return MSGRID(p1) > MSGRID(p2) ? 1 : (MSGRID(p1) == MSGRID(p2) ? 0 : -1);
|
---|
1661 | /* return (*(msg_t **)p1)->realid - (*(msg_t **)p1)->realid; */
|
---|
1662 | }
|
---|
1663 |
|
---|
1664 | /*
|
---|
1665 | * block_messages() basically transposes the messages
|
---|
1666 | * from ID/language based list to a language/ID
|
---|
1667 | * based list.
|
---|
1668 | */
|
---|
1669 | static lan_blk_t *block_messages(node_t *head)
|
---|
1670 | {
|
---|
1671 | lan_blk_t *lbp;
|
---|
1672 | lan_blk_t *lblktail = NULL;
|
---|
1673 | lan_blk_t *lblkhead = NULL;
|
---|
1674 | msg_t **msgtab = NULL;
|
---|
1675 | node_t *ndp;
|
---|
1676 | int nmsg = 0;
|
---|
1677 | int i;
|
---|
1678 | int nl;
|
---|
1679 | int factor = unicodeout ? 2 : 1;
|
---|
1680 |
|
---|
1681 | for(ndp = head; ndp; ndp = ndp->next)
|
---|
1682 | {
|
---|
1683 | if(ndp->type != nd_msg)
|
---|
1684 | continue;
|
---|
1685 | msgtab = xrealloc(msgtab, (nmsg+1) * sizeof(*msgtab));
|
---|
1686 | msgtab[nmsg++] = ndp->u.msg;
|
---|
1687 | }
|
---|
1688 |
|
---|
1689 | assert(nmsg != 0);
|
---|
1690 | qsort(msgtab, nmsg, sizeof(*msgtab), sort_msg);
|
---|
1691 |
|
---|
1692 | for(nl = 0; nl < msgtab[0]->nmsgs; nl++) /* This should be equal for all after check_languages() */
|
---|
1693 | {
|
---|
1694 | lbp = xmalloc(sizeof(lan_blk_t));
|
---|
1695 |
|
---|
1696 | if(!lblktail)
|
---|
1697 | {
|
---|
1698 | lblkhead = lblktail = lbp;
|
---|
1699 | }
|
---|
1700 | else
|
---|
1701 | {
|
---|
1702 | lblktail->next = lbp;
|
---|
1703 | lbp->prev = lblktail;
|
---|
1704 | lblktail = lbp;
|
---|
1705 | }
|
---|
1706 | lbp->nblk = 1;
|
---|
1707 | lbp->blks = xmalloc(sizeof(*lbp->blks));
|
---|
1708 | lbp->blks[0].idlo = msgtab[0]->realid;
|
---|
1709 | lbp->blks[0].idhi = msgtab[0]->realid;
|
---|
1710 | /* The plus 4 is the entry header; (+3)&~3 is DWORD alignment */
|
---|
1711 | lbp->blks[0].size = ((factor * msgtab[0]->msgs[nl]->len + 3) & ~3) + 4;
|
---|
1712 | lbp->blks[0].msgs = xmalloc(sizeof(*lbp->blks[0].msgs));
|
---|
1713 | lbp->blks[0].nmsg = 1;
|
---|
1714 | lbp->blks[0].msgs[0] = msgtab[0]->msgs[nl];
|
---|
1715 | lbp->lan = msgtab[0]->msgs[nl]->lan;
|
---|
1716 |
|
---|
1717 | for(i = 1; i < nmsg; i++)
|
---|
1718 | {
|
---|
1719 | block_t *blk = &(lbp->blks[lbp->nblk-1]);
|
---|
1720 | if(msgtab[i]->realid == blk->idhi+1)
|
---|
1721 | {
|
---|
1722 | blk->size += ((factor * msgtab[i]->msgs[nl]->len + 3) & ~3) + 4;
|
---|
1723 | blk->idhi++;
|
---|
1724 | blk->msgs = xrealloc(blk->msgs, (blk->nmsg+1) * sizeof(*blk->msgs));
|
---|
1725 | blk->msgs[blk->nmsg++] = msgtab[i]->msgs[nl];
|
---|
1726 | }
|
---|
1727 | else
|
---|
1728 | {
|
---|
1729 | lbp->nblk++;
|
---|
1730 | lbp->blks = xrealloc(lbp->blks, lbp->nblk * sizeof(*lbp->blks));
|
---|
1731 | blk = &(lbp->blks[lbp->nblk-1]);
|
---|
1732 | blk->idlo = msgtab[i]->realid;
|
---|
1733 | blk->idhi = msgtab[i]->realid;
|
---|
1734 | blk->size = ((factor * msgtab[i]->msgs[nl]->len + 3) & ~3) + 4;
|
---|
1735 | blk->msgs = xmalloc(sizeof(*blk->msgs));
|
---|
1736 | blk->nmsg = 1;
|
---|
1737 | blk->msgs[0] = msgtab[i]->msgs[nl];
|
---|
1738 | }
|
---|
1739 | }
|
---|
1740 | }
|
---|
1741 | free(msgtab);
|
---|
1742 | return lblkhead;
|
---|
1743 | }
|
---|
1744 |
|
---|
1745 | static int sc_xlat(const void *p1, const void *p2)
|
---|
1746 | {
|
---|
1747 | return ((cp_xlat_t *)p1)->lan - ((cp_xlat_t *)p2)->lan;
|
---|
1748 | }
|
---|
1749 |
|
---|
1750 | static void add_cpxlat(int lan, int cpin, int cpout)
|
---|
1751 | {
|
---|
1752 | cpxlattab = xrealloc(cpxlattab, (ncpxlattab+1) * sizeof(*cpxlattab));
|
---|
1753 | cpxlattab[ncpxlattab].lan = lan;
|
---|
1754 | cpxlattab[ncpxlattab].cpin = cpin;
|
---|
1755 | cpxlattab[ncpxlattab].cpout = cpout;
|
---|
1756 | ncpxlattab++;
|
---|
1757 | qsort(cpxlattab, ncpxlattab, sizeof(*cpxlattab), sc_xlat);
|
---|
1758 | }
|
---|
1759 |
|
---|
1760 | static cp_xlat_t *find_cpxlat(int lan)
|
---|
1761 | {
|
---|
1762 | cp_xlat_t t;
|
---|
1763 |
|
---|
1764 | if(!cpxlattab) return NULL;
|
---|
1765 |
|
---|
1766 | t.lan = lan;
|
---|
1767 | return (cp_xlat_t *)bsearch(&t, cpxlattab, ncpxlattab, sizeof(*cpxlattab), sc_xlat);
|
---|
1768 | }
|
---|