*** empty log message ***
[deliverable/binutils-gdb.git] / gdb / expread.tab.c
1
2 /* A Bison parser, made from ../expread.y */
3
4 #define INT 258
5 #define CHAR 259
6 #define UINT 260
7 #define FLOAT 261
8 #define STRING 262
9 #define NAME 263
10 #define BLOCKNAME 264
11 #define TYPENAME 265
12 #define NAME_OR_INT 266
13 #define NAME_OR_UINT 267
14 #define STRUCT 268
15 #define UNION 269
16 #define ENUM 270
17 #define SIZEOF 271
18 #define UNSIGNED 272
19 #define COLONCOLON 273
20 #define ERROR 274
21 #define SIGNED 275
22 #define LONG 276
23 #define SHORT 277
24 #define INT_KEYWORD 278
25 #define LAST 279
26 #define REGNAME 280
27 #define VARIABLE 281
28 #define ASSIGN_MODIFY 282
29 #define THIS 283
30 #define ABOVE_COMMA 284
31 #define OR 285
32 #define AND 286
33 #define EQUAL 287
34 #define NOTEQUAL 288
35 #define LEQ 289
36 #define GEQ 290
37 #define LSH 291
38 #define RSH 292
39 #define UNARY 293
40 #define INCREMENT 294
41 #define DECREMENT 295
42 #define ARROW 296
43
44 #line 29 "../expread.y"
45
46 #include <stdio.h>
47 #include "defs.h"
48 #include "param.h"
49 #include "symtab.h"
50 #include "frame.h"
51 #include "expression.h"
52 #include "value.h"
53 #include "command.h"
54
55 static struct expression *expout;
56 static int expout_size;
57 static int expout_ptr;
58
59 static int yylex ();
60 static void yyerror ();
61 static void write_exp_elt ();
62 static void write_exp_elt_opcode ();
63 static void write_exp_elt_sym ();
64 static void write_exp_elt_longcst ();
65 static void write_exp_elt_dblcst ();
66 static void write_exp_elt_type ();
67 static void write_exp_elt_intern ();
68 static void write_exp_string ();
69 static void start_arglist ();
70 static int end_arglist ();
71 static void free_funcalls ();
72 static char *copy_name ();
73 static int parse_number ();
74
75 /* If this is nonzero, this block is used as the lexical context
76 for symbol names. */
77
78 static struct block *expression_context_block;
79
80 /* The innermost context required by the stack and register variables
81 we've encountered so far. */
82 struct block *innermost_block;
83
84 /* The block in which the most recently discovered symbol was found. */
85 struct block *block_found;
86
87 /* Number of arguments seen so far in innermost function call. */
88 static int arglist_len;
89
90 /* Data structure for saving values of arglist_len
91 for function calls whose arguments contain other function calls. */
92
93 struct funcall
94 {
95 struct funcall *next;
96 int arglist_len;
97 };
98
99 struct funcall *funcall_chain;
100
101 /* This kind of datum is used to represent the name
102 of a symbol token. */
103
104 struct stoken
105 {
106 char *ptr;
107 int length;
108 };
109
110 struct ttype
111 {
112 struct stoken stoken;
113 struct type *type;
114 };
115
116 struct symtoken
117 {
118 struct stoken stoken;
119 struct symbol *sym;
120 int is_a_field_of_this;
121 };
122
123 /* For parsing of complicated types.
124 An array should be preceded in the list by the size of the array. */
125 enum type_pieces
126 {tp_end = -1, tp_pointer, tp_reference, tp_array, tp_function};
127 static enum type_pieces *type_stack;
128 static int type_stack_depth, type_stack_size;
129
130 static void push_type ();
131 static enum type_pieces pop_type ();
132
133 /* Allow debugging of parsing. */
134 #define YYDEBUG 1
135
136 #line 125 "../expread.y"
137 typedef union
138 {
139 LONGEST lval;
140 unsigned LONGEST ulval;
141 double dval;
142 struct symbol *sym;
143 struct type *tval;
144 struct stoken sval;
145 struct ttype tsym;
146 struct symtoken ssym;
147 int voidval;
148 struct block *bval;
149 enum exp_opcode opcode;
150 struct internalvar *ivar;
151
152 struct type **tvec;
153 int *ivec;
154 } YYSTYPE;
155
156 #ifndef YYLTYPE
157 typedef
158 struct yyltype
159 {
160 int timestamp;
161 int first_line;
162 int first_column;
163 int last_line;
164 int last_column;
165 char *text;
166 }
167 yyltype;
168
169 #define YYLTYPE yyltype
170 #endif
171
172 #include <stdio.h>
173
174 #ifndef __STDC__
175 #define const
176 #endif
177
178
179
180 #define YYFINAL 197
181 #define YYFLAG -32768
182 #define YYNTBASE 66
183
184 #define YYTRANSLATE(x) ((unsigned)(x) <= 296 ? yytranslate[x] : 84)
185
186 static const char yytranslate[] = { 0,
187 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
188 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
189 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
190 2, 2, 59, 2, 2, 2, 51, 37, 2, 58,
191 62, 49, 47, 29, 48, 56, 50, 2, 2, 2,
192 2, 2, 2, 2, 2, 2, 2, 65, 2, 40,
193 31, 41, 32, 46, 2, 2, 2, 2, 2, 2,
194 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
195 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
196 57, 2, 61, 36, 2, 2, 2, 2, 2, 2,
197 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
198 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
199 2, 2, 63, 35, 64, 60, 2, 2, 2, 2,
200 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
201 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
202 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
203 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
204 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
205 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
206 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
207 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
208 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
209 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
210 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
211 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
212 2, 2, 2, 2, 2, 1, 2, 3, 4, 5,
213 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
214 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
215 26, 27, 28, 30, 33, 34, 38, 39, 42, 43,
216 44, 45, 52, 53, 54, 55
217 };
218
219 static const short yyrline[] = { 0,
220 218, 222, 223, 228, 231, 234, 238, 242, 246, 250,
221 254, 258, 262, 266, 272, 276, 282, 286, 290, 294,
222 300, 303, 307, 311, 317, 323, 329, 333, 337, 341,
223 345, 349, 353, 357, 361, 365, 369, 373, 377, 381,
224 385, 389, 393, 397, 401, 405, 409, 413, 419, 429,
225 442, 454, 467, 474, 481, 484, 490, 496, 502, 509,
226 516, 523, 541, 551, 563, 576, 594, 640, 714, 715,
227 750, 752, 754, 756, 758, 761, 763, 768, 774, 776,
228 780, 782, 786, 790, 791, 793, 795, 798, 805, 807,
229 809, 811, 813, 815, 817, 819, 821, 823, 825, 827,
230 829, 832, 835, 838, 840, 842, 844, 848, 849, 855,
231 861, 870, 875, 882, 883, 884, 885, 886, 889, 890
232 };
233
234 static const char * const yytname[] = { 0,
235 "error","$illegal.","INT","CHAR","UINT","FLOAT","STRING","NAME","BLOCKNAME","TYPENAME",
236 "NAME_OR_INT","NAME_OR_UINT","STRUCT","UNION","ENUM","SIZEOF","UNSIGNED","COLONCOLON","ERROR","SIGNED",
237 "LONG","SHORT","INT_KEYWORD","LAST","REGNAME","VARIABLE","ASSIGN_MODIFY","THIS","','","ABOVE_COMMA",
238 "'='","'?'","OR","AND","'|'","'^'","'&'","EQUAL","NOTEQUAL","'<'",
239 "'>'","LEQ","GEQ","LSH","RSH","'@'","'+'","'-'","'*'","'/'",
240 "'%'","UNARY","INCREMENT","DECREMENT","ARROW","'.'","'['","'('","'!'","'~'",
241 "']'","')'","'{'","'}'","':'","start"
242 };
243
244 static const short yyr1[] = { 0,
245 66, 67, 67, 68, 68, 68, 68, 68, 68, 68,
246 68, 68, 68, 68, 68, 68, 68, 68, 69, 68,
247 70, 70, 70, 68, 68, 68, 68, 68, 68, 68,
248 68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
249 68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
250 68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
251 68, 71, 71, 72, 72, 72, 72, 72, 73, 73,
252 74, 74, 74, 74, 74, 75, 75, 75, 75, 75,
253 76, 76, 77, 78, 78, 78, 78, 78, 79, 79,
254 79, 79, 79, 79, 79, 79, 79, 79, 79, 79,
255 79, 79, 79, 79, 79, 79, 79, 80, 80, 80,
256 80, 81, 81, 82, 82, 82, 82, 82, 83, 83
257 };
258
259 static const short yyr2[] = { 0,
260 1, 1, 3, 2, 2, 2, 2, 2, 2, 2,
261 2, 2, 2, 3, 4, 3, 4, 4, 0, 5,
262 0, 1, 3, 4, 4, 3, 3, 3, 3, 3,
263 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
264 3, 3, 3, 3, 3, 5, 3, 3, 1, 1,
265 1, 1, 1, 1, 1, 1, 1, 1, 4, 1,
266 1, 1, 3, 3, 3, 4, 2, 1, 1, 2,
267 1, 2, 1, 2, 1, 3, 2, 1, 2, 1,
268 2, 3, 2, 1, 3, 6, 8, 9, 1, 1,
269 1, 1, 2, 3, 2, 3, 3, 4, 2, 3,
270 2, 2, 2, 2, 1, 2, 1, 1, 1, 1,
271 1, 1, 3, 1, 1, 1, 1, 1, 1, 1
272 };
273
274 static const short yydefact[] = { 0,
275 49, 53, 51, 54, 60, 119, 120, 89, 50, 52,
276 0, 0, 0, 0, 105, 0, 107, 91, 92, 90,
277 56, 57, 58, 61, 0, 0, 0, 0, 0, 0,
278 0, 0, 0, 1, 2, 0, 55, 0, 68, 114,
279 115, 116, 117, 118, 101, 102, 103, 0, 13, 108,
280 110, 111, 109, 104, 67, 110, 111, 106, 95, 93,
281 99, 5, 6, 4, 9, 10, 0, 84, 0, 69,
282 7, 8, 0, 69, 0, 0, 0, 0, 0, 0,
283 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
284 0, 0, 0, 0, 0, 0, 0, 11, 12, 0,
285 0, 0, 19, 0, 0, 0, 97, 94, 100, 96,
286 26, 0, 0, 0, 73, 71, 0, 0, 70, 75,
287 78, 80, 0, 0, 3, 48, 47, 0, 45, 44,
288 43, 42, 41, 35, 36, 39, 40, 37, 38, 33,
289 34, 27, 31, 32, 28, 29, 30, 0, 14, 0,
290 16, 0, 21, 64, 0, 65, 59, 98, 0, 25,
291 85, 74, 72, 0, 81, 83, 0, 0, 77, 79,
292 24, 0, 15, 17, 18, 22, 0, 66, 0, 82,
293 76, 46, 0, 20, 0, 23, 86, 0, 87, 112,
294 0, 0, 88, 113, 0, 0, 0
295 };
296
297 static const short yydefgoto[] = { 195,
298 67, 35, 153, 177, 36, 37, 68, 119, 120, 121,
299 122, 69, 38, 54, 191, 156, 39
300 };
301
302 static const short yypact[] = { 167,
303 -32768,-32768,-32768,-32768,-32768,-32768, 7,-32768,-32768,-32768,
304 22, 22, 22, 228, 190, 22, 245, 119, -7,-32768,
305 -32768,-32768,-32768,-32768, 167, 167, 167, 167, 167, 167,
306 167, 167, 528, 60, 303, 33,-32768, 76,-32768,-32768,
307 -32768,-32768,-32768,-32768,-32768,-32768,-32768, 167, 216,-32768,
308 134, 77,-32768,-32768,-32768,-32768,-32768,-32768, 78,-32768,
309 -32768, 216, 216, 216, 216, 216, 59,-32768, -52, 75,
310 216, 216, -55, 80, 167, 167, 167, 167, 167, 167,
311 167, 167, 167, 167, 167, 167, 167, 167, 167, 167,
312 167, 167, 167, 167, 167, 167, 167,-32768,-32768, 198,
313 249, 167,-32768, 22, 138, -34, 90,-32768,-32768,-32768,
314 -32768, 528, 167, 96, 165, 165, 26, 104,-32768, -50,
315 -32768,-32768, 167, 47, 303, 303, 303, 268, 355, 379,
316 402, 424, 445, 464, 464, 479, 479, 479, 479, 506,
317 506, 518, 529, 529, 216, 216, 216, 167,-32768, 167,
318 -32768, -2, 167, 98, 22,-32768, 32,-32768, 113, 216,
319 -32768,-32768,-32768, 62,-32768,-32768, 82, 106,-32768,-32768,
320 216, 167, 216, 216,-32768, 303, 68,-32768, 137,-32768,
321 -32768, 330, 167,-32768, 132, 303, 139, 105,-32768, 141,
322 73, 528,-32768, 141, 196, 201,-32768
323 };
324
325 static const short yypgoto[] = {-32768,
326 1, -14,-32768,-32768,-32768,-32768,-32768, 36,-32768, 83,
327 85, -29, -28, 200,-32768, 10,-32768
328 };
329
330
331 #define YYLAST 587
332
333
334 static const short yytable[] = { 49,
335 34, 70, 112, 73, 74, 112, 117, 168, 123, 113,
336 62, 63, 64, 65, 66, 61, 71, 72, 106, 70,
337 45, 46, 47, 112, -62, 55, 75, 157, 164, 40,
338 41, 42, 43, 44, 1, 2, 3, 4, 5, 6,
339 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
340 104, 17, 18, 19, 20, 21, 22, 23, 175, 24,
341 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
342 135, 136, 137, 138, 139, 140, 141, 142, 143, 144,
343 145, 146, 147, 159, 28, 29, 165, 75, 75, 30,
344 31, 32, 114, 105, 33, 161, 183, 124, 160, 109,
345 110, 192, 152, 40, 41, 42, 43, 44, 171, 149,
346 151, 115, 158, 154, 8, -63, 115, 11, 12, 13,
347 111, 15, 180, 116, 17, 18, 19, 20, 116, 184,
348 179, 117, 118, 173, 193, 174, 117, 118, 176, 59,
349 115, 60, 160, 181, 161, 40, 41, 42, 43, 44,
350 162, 163, 116, 167, 107, 155, 108, 182, 190, 74,
351 117, 118, 194, 74, 178, 166, 189, 166, 186, 1,
352 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
353 12, 13, 14, 15, 16, 185, 17, 18, 19, 20,
354 21, 22, 23, 187, 24, 196, 188, 155, 112, 50,
355 197, 115, 169, 25, 170, 40, 41, 42, 43, 44,
356 51, 52, 53, 116, 26, 27, 58, 0, 0, 28,
357 29, 117, 118, 0, 30, 31, 32, 0, 0, 33,
358 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
359 11, 12, 13, 14, 15, 16, 148, 17, 18, 19,
360 20, 21, 22, 23, 50, 24, 40, 41, 42, 43,
361 44, 0, 0, 0, 25, 56, 57, 53, 98, 99,
362 100, 101, 102, 103, 0, 26, 27, 0, 0, 0,
363 28, 29, 0, 0, 0, 48, 31, 32, 0, 0,
364 33, 0, 0, 0, 76, 0, 0, 150, 77, 78,
365 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
366 89, 90, 91, 92, 93, 94, 95, 96, 97, 0,
367 98, 99, 100, 101, 102, 103, 0, 0, 0, 76,
368 0, 0, 172, 77, 78, 79, 80, 81, 82, 83,
369 84, 85, 86, 87, 88, 89, 90, 91, 92, 93,
370 94, 95, 96, 97, 0, 98, 99, 100, 101, 102,
371 103, 78, 79, 80, 81, 82, 83, 84, 85, 86,
372 87, 88, 89, 90, 91, 92, 93, 94, 95, 96,
373 97, 0, 98, 99, 100, 101, 102, 103, 80, 81,
374 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
375 92, 93, 94, 95, 96, 97, 0, 98, 99, 100,
376 101, 102, 103, 81, 82, 83, 84, 85, 86, 87,
377 88, 89, 90, 91, 92, 93, 94, 95, 96, 97,
378 0, 98, 99, 100, 101, 102, 103, 82, 83, 84,
379 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
380 95, 96, 97, 0, 98, 99, 100, 101, 102, 103,
381 83, 84, 85, 86, 87, 88, 89, 90, 91, 92,
382 93, 94, 95, 96, 97, 0, 98, 99, 100, 101,
383 102, 103, 84, 85, 86, 87, 88, 89, 90, 91,
384 92, 93, 94, 95, 96, 97, 0, 98, 99, 100,
385 101, 102, 103, 86, 87, 88, 89, 90, 91, 92,
386 93, 94, 95, 96, 97, 0, 98, 99, 100, 101,
387 102, 103, 90, 91, 92, 93, 94, 95, 96, 97,
388 0, 98, 99, 100, 101, 102, 103, 8, 0, 0,
389 11, 12, 13, 0, 15, 0, 0, 17, 18, 19,
390 20, 92, 93, 94, 95, 96, 97, 0, 98, 99,
391 100, 101, 102, 103, 93, 94, 95, 96, 97, 0,
392 98, 99, 100, 101, 102, 103, 0, 95, 96, 97,
393 0, 98, 99, 100, 101, 102, 103
394 };
395
396 static const short yycheck[] = { 14,
397 0, 30, 58, 33, 33, 58, 57, 58, 64, 62,
398 25, 26, 27, 28, 29, 23, 31, 32, 48, 48,
399 11, 12, 13, 58, 18, 16, 29, 62, 3, 8,
400 9, 10, 11, 12, 3, 4, 5, 6, 7, 8,
401 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
402 18, 20, 21, 22, 23, 24, 25, 26, 61, 28,
403 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
404 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
405 95, 96, 97, 112, 53, 54, 61, 29, 29, 58,
406 59, 60, 18, 18, 63, 49, 29, 18, 113, 23,
407 23, 29, 102, 8, 9, 10, 11, 12, 123, 100,
408 101, 37, 23, 104, 10, 18, 37, 13, 14, 15,
409 62, 17, 61, 49, 20, 21, 22, 23, 49, 62,
410 18, 57, 58, 148, 62, 150, 57, 58, 153, 21,
411 37, 23, 157, 62, 49, 8, 9, 10, 11, 12,
412 115, 116, 49, 118, 21, 60, 23, 172, 188, 188,
413 57, 58, 192, 192, 155, 62, 62, 62, 183, 3,
414 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
415 14, 15, 16, 17, 18, 49, 20, 21, 22, 23,
416 24, 25, 26, 62, 28, 0, 58, 60, 58, 10,
417 0, 37, 120, 37, 120, 8, 9, 10, 11, 12,
418 21, 22, 23, 49, 48, 49, 17, -1, -1, 53,
419 54, 57, 58, -1, 58, 59, 60, -1, -1, 63,
420 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
421 13, 14, 15, 16, 17, 18, 49, 20, 21, 22,
422 23, 24, 25, 26, 10, 28, 8, 9, 10, 11,
423 12, -1, -1, -1, 37, 21, 22, 23, 53, 54,
424 55, 56, 57, 58, -1, 48, 49, -1, -1, -1,
425 53, 54, -1, -1, -1, 58, 59, 60, -1, -1,
426 63, -1, -1, -1, 27, -1, -1, 49, 31, 32,
427 33, 34, 35, 36, 37, 38, 39, 40, 41, 42,
428 43, 44, 45, 46, 47, 48, 49, 50, 51, -1,
429 53, 54, 55, 56, 57, 58, -1, -1, -1, 27,
430 -1, -1, 65, 31, 32, 33, 34, 35, 36, 37,
431 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
432 48, 49, 50, 51, -1, 53, 54, 55, 56, 57,
433 58, 32, 33, 34, 35, 36, 37, 38, 39, 40,
434 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
435 51, -1, 53, 54, 55, 56, 57, 58, 34, 35,
436 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
437 46, 47, 48, 49, 50, 51, -1, 53, 54, 55,
438 56, 57, 58, 35, 36, 37, 38, 39, 40, 41,
439 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
440 -1, 53, 54, 55, 56, 57, 58, 36, 37, 38,
441 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
442 49, 50, 51, -1, 53, 54, 55, 56, 57, 58,
443 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
444 47, 48, 49, 50, 51, -1, 53, 54, 55, 56,
445 57, 58, 38, 39, 40, 41, 42, 43, 44, 45,
446 46, 47, 48, 49, 50, 51, -1, 53, 54, 55,
447 56, 57, 58, 40, 41, 42, 43, 44, 45, 46,
448 47, 48, 49, 50, 51, -1, 53, 54, 55, 56,
449 57, 58, 44, 45, 46, 47, 48, 49, 50, 51,
450 -1, 53, 54, 55, 56, 57, 58, 10, -1, -1,
451 13, 14, 15, -1, 17, -1, -1, 20, 21, 22,
452 23, 46, 47, 48, 49, 50, 51, -1, 53, 54,
453 55, 56, 57, 58, 47, 48, 49, 50, 51, -1,
454 53, 54, 55, 56, 57, 58, -1, 49, 50, 51,
455 -1, 53, 54, 55, 56, 57, 58
456 };
457 #define YYPURE 1
458
459 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
460 #line 3 "bison.simple"
461
462 /* Skeleton output parser for bison,
463 Copyright (C) 1984 Bob Corbett and Richard Stallman
464
465 This program is free software; you can redistribute it and/or modify
466 it under the terms of the GNU General Public License as published by
467 the Free Software Foundation; either version 1, or (at your option)
468 any later version.
469
470 This program is distributed in the hope that it will be useful,
471 but WITHOUT ANY WARRANTY; without even the implied warranty of
472 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
473 GNU General Public License for more details.
474
475 You should have received a copy of the GNU General Public License
476 along with this program; if not, write to the Free Software
477 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
478
479
480 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__)
481 #include <alloca.h>
482 #endif
483
484 /* This is the parser code that is written into each bison parser
485 when the %semantic_parser declaration is not specified in the grammar.
486 It was written by Richard Stallman by simplifying the hairy parser
487 used when %semantic_parser is specified. */
488
489 /* Note: there must be only one dollar sign in this file.
490 It is replaced by the list of actions, each action
491 as one case of the switch. */
492
493 #define yyerrok (yyerrstatus = 0)
494 #define yyclearin (yychar = YYEMPTY)
495 #define YYEMPTY -2
496 #define YYEOF 0
497 #define YYFAIL goto yyerrlab;
498 #define YYACCEPT return(0)
499 #define YYABORT return(1)
500 #define YYERROR goto yyerrlab
501
502 #define YYTERROR 1
503 #define YYERRCODE 256
504
505 #ifndef YYIMPURE
506 #define YYLEX yylex()
507 #endif
508
509 #ifndef YYPURE
510 #define YYLEX yylex(&yylval, &yylloc)
511 #endif
512
513 /* If nonreentrant, generate the variables here */
514
515 #ifndef YYIMPURE
516
517 int yychar; /* the lookahead symbol */
518 YYSTYPE yylval; /* the semantic value of the */
519 /* lookahead symbol */
520
521 YYLTYPE yylloc; /* location data for the lookahead */
522 /* symbol */
523
524 int yynerrs; /* number of parse errors so far */
525 #endif /* YYIMPURE */
526
527 #if YYDEBUG != 0
528 int yydebug; /* nonzero means print parse trace */
529 /* Since this is uninitialized, it does not stop multiple parsers
530 from coexisting. */
531 #endif
532
533 /* YYMAXDEPTH indicates the initial size of the parser's stacks */
534
535 #ifndef YYMAXDEPTH
536 #define YYMAXDEPTH 200
537 #endif
538
539 /* YYMAXLIMIT is the maximum size the stacks can grow to
540 (effective only if the built-in stack extension method is used). */
541
542 #ifndef YYMAXLIMIT
543 #define YYMAXLIMIT 10000
544 #endif
545
546
547 #line 90 "bison.simple"
548 int
549 yyparse()
550 {
551 register int yystate;
552 register int yyn;
553 register short *yyssp;
554 register YYSTYPE *yyvsp;
555 YYLTYPE *yylsp;
556 int yyerrstatus; /* number of tokens to shift before error messages enabled */
557 int yychar1; /* lookahead token as an internal (translated) token number */
558
559 short yyssa[YYMAXDEPTH]; /* the state stack */
560 YYSTYPE yyvsa[YYMAXDEPTH]; /* the semantic value stack */
561 YYLTYPE yylsa[YYMAXDEPTH]; /* the location stack */
562
563 short *yyss = yyssa; /* refer to the stacks thru separate pointers */
564 YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
565 YYLTYPE *yyls = yylsa;
566
567 int yymaxdepth = YYMAXDEPTH;
568
569 #ifndef YYPURE
570 int yychar;
571 YYSTYPE yylval;
572 YYLTYPE yylloc;
573 int yynerrs;
574 #endif
575
576 YYSTYPE yyval; /* the variable used to return */
577 /* semantic values from the action */
578 /* routines */
579
580 int yylen;
581
582 #if YYDEBUG != 0
583 if (yydebug)
584 fprintf(stderr, "Starting parse\n");
585 #endif
586
587 yystate = 0;
588 yyerrstatus = 0;
589 yynerrs = 0;
590 yychar = YYEMPTY; /* Cause a token to be read. */
591
592 /* Initialize stack pointers.
593 Waste one element of value and location stack
594 so that they stay on the same level as the state stack. */
595
596 yyssp = yyss - 1;
597 yyvsp = yyvs;
598 yylsp = yyls;
599
600 /* Push a new state, which is found in yystate . */
601 /* In all cases, when you get here, the value and location stacks
602 have just been pushed. so pushing a state here evens the stacks. */
603 yynewstate:
604
605 *++yyssp = yystate;
606
607 if (yyssp >= yyss + yymaxdepth - 1)
608 {
609 /* Give user a chance to reallocate the stack */
610 /* Use copies of these so that the &'s don't force the real ones into memory. */
611 YYSTYPE *yyvs1 = yyvs;
612 YYLTYPE *yyls1 = yyls;
613 short *yyss1 = yyss;
614
615 /* Get the current used size of the three stacks, in elements. */
616 int size = yyssp - yyss + 1;
617
618 #ifdef yyoverflow
619 /* Each stack pointer address is followed by the size of
620 the data in use in that stack, in bytes. */
621 yyoverflow("parser stack overflow",
622 &yyss1, size * sizeof (*yyssp),
623 &yyvs1, size * sizeof (*yyvsp),
624 &yyls1, size * sizeof (*yylsp),
625 &yymaxdepth);
626
627 yyss = yyss1; yyvs = yyvs1; yyls = yyls1;
628 #else /* no yyoverflow */
629 /* Extend the stack our own way. */
630 if (yymaxdepth >= YYMAXLIMIT)
631 yyerror("parser stack overflow");
632 yymaxdepth *= 2;
633 if (yymaxdepth > YYMAXLIMIT)
634 yymaxdepth = YYMAXLIMIT;
635 yyss = (short *) alloca (yymaxdepth * sizeof (*yyssp));
636 bcopy ((char *)yyss1, (char *)yyss, size * sizeof (*yyssp));
637 yyvs = (YYSTYPE *) alloca (yymaxdepth * sizeof (*yyvsp));
638 bcopy ((char *)yyvs1, (char *)yyvs, size * sizeof (*yyvsp));
639 #ifdef YYLSP_NEEDED
640 yyls = (YYLTYPE *) alloca (yymaxdepth * sizeof (*yylsp));
641 bcopy ((char *)yyls1, (char *)yyls, size * sizeof (*yylsp));
642 #endif
643 #endif /* no yyoverflow */
644
645 yyssp = yyss + size - 1;
646 yyvsp = yyvs + size - 1;
647 #ifdef YYLSP_NEEDED
648 yylsp = yyls + size - 1;
649 #endif
650
651 #if YYDEBUG != 0
652 if (yydebug)
653 fprintf(stderr, "Stack size increased to %d\n", yymaxdepth);
654 #endif
655
656 if (yyssp >= yyss + yymaxdepth - 1)
657 YYABORT;
658 }
659
660 #if YYDEBUG != 0
661 if (yydebug)
662 fprintf(stderr, "Entering state %d\n", yystate);
663 #endif
664
665 /* Do appropriate processing given the current state. */
666 /* Read a lookahead token if we need one and don't already have one. */
667 yyresume:
668
669 /* First try to decide what to do without reference to lookahead token. */
670
671 yyn = yypact[yystate];
672 if (yyn == YYFLAG)
673 goto yydefault;
674
675 /* Not known => get a lookahead token if don't already have one. */
676
677 /* yychar is either YYEMPTY or YYEOF
678 or a valid token in external form. */
679
680 if (yychar == YYEMPTY)
681 {
682 #if YYDEBUG != 0
683 if (yydebug)
684 fprintf(stderr, "Reading a token: ");
685 #endif
686 yychar = YYLEX;
687 }
688
689 /* Convert token to internal form (in yychar1) for indexing tables with */
690
691 if (yychar <= 0) /* This means end of input. */
692 {
693 yychar1 = 0;
694 yychar = YYEOF; /* Don't call YYLEX any more */
695
696 #if YYDEBUG != 0
697 if (yydebug)
698 fprintf(stderr, "Now at end of input.\n");
699 #endif
700 }
701 else
702 {
703 yychar1 = YYTRANSLATE(yychar);
704
705 #if YYDEBUG != 0
706 if (yydebug)
707 fprintf(stderr, "Next token is %d (%s)\n", yychar, yytname[yychar1]);
708 #endif
709 }
710
711 yyn += yychar1;
712 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
713 goto yydefault;
714
715 yyn = yytable[yyn];
716
717 /* yyn is what to do for this token type in this state.
718 Negative => reduce, -yyn is rule number.
719 Positive => shift, yyn is new state.
720 New state is final state => don't bother to shift,
721 just return success.
722 0, or most negative number => error. */
723
724 if (yyn < 0)
725 {
726 if (yyn == YYFLAG)
727 goto yyerrlab;
728 yyn = -yyn;
729 goto yyreduce;
730 }
731 else if (yyn == 0)
732 goto yyerrlab;
733
734 if (yyn == YYFINAL)
735 YYACCEPT;
736
737 /* Shift the lookahead token. */
738
739 #if YYDEBUG != 0
740 if (yydebug)
741 fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
742 #endif
743
744 /* Discard the token being shifted unless it is eof. */
745 if (yychar != YYEOF)
746 yychar = YYEMPTY;
747
748 *++yyvsp = yylval;
749 #ifdef YYLSP_NEEDED
750 *++yylsp = yylloc;
751 #endif
752
753 /* count tokens shifted since error; after three, turn off error status. */
754 if (yyerrstatus) yyerrstatus--;
755
756 yystate = yyn;
757 goto yynewstate;
758
759 /* Do the default action for the current state. */
760 yydefault:
761
762 yyn = yydefact[yystate];
763 if (yyn == 0)
764 goto yyerrlab;
765
766 /* Do a reduction. yyn is the number of a rule to reduce with. */
767 yyreduce:
768 yylen = yyr2[yyn];
769 yyval = yyvsp[1-yylen]; /* implement default value of the action */
770
771 #if YYDEBUG != 0
772 if (yydebug)
773 {
774 if (yylen == 1)
775 fprintf (stderr, "Reducing 1 value via line %d, ",
776 yyrline[yyn]);
777 else
778 fprintf (stderr, "Reducing %d values via line %d, ",
779 yylen, yyrline[yyn]);
780 }
781 #endif
782
783
784 switch (yyn) {
785
786 case 3:
787 #line 224 "../expread.y"
788 { write_exp_elt_opcode (BINOP_COMMA); ;
789 break;}
790 case 4:
791 #line 229 "../expread.y"
792 { write_exp_elt_opcode (UNOP_IND); ;
793 break;}
794 case 5:
795 #line 232 "../expread.y"
796 { write_exp_elt_opcode (UNOP_ADDR); ;
797 break;}
798 case 6:
799 #line 235 "../expread.y"
800 { write_exp_elt_opcode (UNOP_NEG); ;
801 break;}
802 case 7:
803 #line 239 "../expread.y"
804 { write_exp_elt_opcode (UNOP_ZEROP); ;
805 break;}
806 case 8:
807 #line 243 "../expread.y"
808 { write_exp_elt_opcode (UNOP_LOGNOT); ;
809 break;}
810 case 9:
811 #line 247 "../expread.y"
812 { write_exp_elt_opcode (UNOP_PREINCREMENT); ;
813 break;}
814 case 10:
815 #line 251 "../expread.y"
816 { write_exp_elt_opcode (UNOP_PREDECREMENT); ;
817 break;}
818 case 11:
819 #line 255 "../expread.y"
820 { write_exp_elt_opcode (UNOP_POSTINCREMENT); ;
821 break;}
822 case 12:
823 #line 259 "../expread.y"
824 { write_exp_elt_opcode (UNOP_POSTDECREMENT); ;
825 break;}
826 case 13:
827 #line 263 "../expread.y"
828 { write_exp_elt_opcode (UNOP_SIZEOF); ;
829 break;}
830 case 14:
831 #line 267 "../expread.y"
832 { write_exp_elt_opcode (STRUCTOP_PTR);
833 write_exp_string (yyvsp[0].sval);
834 write_exp_elt_opcode (STRUCTOP_PTR); ;
835 break;}
836 case 15:
837 #line 273 "../expread.y"
838 { write_exp_elt_opcode (STRUCTOP_MPTR); ;
839 break;}
840 case 16:
841 #line 277 "../expread.y"
842 { write_exp_elt_opcode (STRUCTOP_STRUCT);
843 write_exp_string (yyvsp[0].sval);
844 write_exp_elt_opcode (STRUCTOP_STRUCT); ;
845 break;}
846 case 17:
847 #line 283 "../expread.y"
848 { write_exp_elt_opcode (STRUCTOP_MEMBER); ;
849 break;}
850 case 18:
851 #line 287 "../expread.y"
852 { write_exp_elt_opcode (BINOP_SUBSCRIPT); ;
853 break;}
854 case 19:
855 #line 293 "../expread.y"
856 { start_arglist (); ;
857 break;}
858 case 20:
859 #line 295 "../expread.y"
860 { write_exp_elt_opcode (OP_FUNCALL);
861 write_exp_elt_longcst ((LONGEST) end_arglist ());
862 write_exp_elt_opcode (OP_FUNCALL); ;
863 break;}
864 case 22:
865 #line 304 "../expread.y"
866 { arglist_len = 1; ;
867 break;}
868 case 23:
869 #line 308 "../expread.y"
870 { arglist_len++; ;
871 break;}
872 case 24:
873 #line 312 "../expread.y"
874 { write_exp_elt_opcode (UNOP_MEMVAL);
875 write_exp_elt_type (yyvsp[-2].tval);
876 write_exp_elt_opcode (UNOP_MEMVAL); ;
877 break;}
878 case 25:
879 #line 318 "../expread.y"
880 { write_exp_elt_opcode (UNOP_CAST);
881 write_exp_elt_type (yyvsp[-2].tval);
882 write_exp_elt_opcode (UNOP_CAST); ;
883 break;}
884 case 26:
885 #line 324 "../expread.y"
886 { ;
887 break;}
888 case 27:
889 #line 330 "../expread.y"
890 { write_exp_elt_opcode (BINOP_REPEAT); ;
891 break;}
892 case 28:
893 #line 334 "../expread.y"
894 { write_exp_elt_opcode (BINOP_MUL); ;
895 break;}
896 case 29:
897 #line 338 "../expread.y"
898 { write_exp_elt_opcode (BINOP_DIV); ;
899 break;}
900 case 30:
901 #line 342 "../expread.y"
902 { write_exp_elt_opcode (BINOP_REM); ;
903 break;}
904 case 31:
905 #line 346 "../expread.y"
906 { write_exp_elt_opcode (BINOP_ADD); ;
907 break;}
908 case 32:
909 #line 350 "../expread.y"
910 { write_exp_elt_opcode (BINOP_SUB); ;
911 break;}
912 case 33:
913 #line 354 "../expread.y"
914 { write_exp_elt_opcode (BINOP_LSH); ;
915 break;}
916 case 34:
917 #line 358 "../expread.y"
918 { write_exp_elt_opcode (BINOP_RSH); ;
919 break;}
920 case 35:
921 #line 362 "../expread.y"
922 { write_exp_elt_opcode (BINOP_EQUAL); ;
923 break;}
924 case 36:
925 #line 366 "../expread.y"
926 { write_exp_elt_opcode (BINOP_NOTEQUAL); ;
927 break;}
928 case 37:
929 #line 370 "../expread.y"
930 { write_exp_elt_opcode (BINOP_LEQ); ;
931 break;}
932 case 38:
933 #line 374 "../expread.y"
934 { write_exp_elt_opcode (BINOP_GEQ); ;
935 break;}
936 case 39:
937 #line 378 "../expread.y"
938 { write_exp_elt_opcode (BINOP_LESS); ;
939 break;}
940 case 40:
941 #line 382 "../expread.y"
942 { write_exp_elt_opcode (BINOP_GTR); ;
943 break;}
944 case 41:
945 #line 386 "../expread.y"
946 { write_exp_elt_opcode (BINOP_LOGAND); ;
947 break;}
948 case 42:
949 #line 390 "../expread.y"
950 { write_exp_elt_opcode (BINOP_LOGXOR); ;
951 break;}
952 case 43:
953 #line 394 "../expread.y"
954 { write_exp_elt_opcode (BINOP_LOGIOR); ;
955 break;}
956 case 44:
957 #line 398 "../expread.y"
958 { write_exp_elt_opcode (BINOP_AND); ;
959 break;}
960 case 45:
961 #line 402 "../expread.y"
962 { write_exp_elt_opcode (BINOP_OR); ;
963 break;}
964 case 46:
965 #line 406 "../expread.y"
966 { write_exp_elt_opcode (TERNOP_COND); ;
967 break;}
968 case 47:
969 #line 410 "../expread.y"
970 { write_exp_elt_opcode (BINOP_ASSIGN); ;
971 break;}
972 case 48:
973 #line 414 "../expread.y"
974 { write_exp_elt_opcode (BINOP_ASSIGN_MODIFY);
975 write_exp_elt_opcode (yyvsp[-1].opcode);
976 write_exp_elt_opcode (BINOP_ASSIGN_MODIFY); ;
977 break;}
978 case 49:
979 #line 420 "../expread.y"
980 { write_exp_elt_opcode (OP_LONG);
981 if (yyvsp[0].lval == (int) yyvsp[0].lval || yyvsp[0].lval == (unsigned int) yyvsp[0].lval)
982 write_exp_elt_type (builtin_type_int);
983 else
984 write_exp_elt_type (BUILTIN_TYPE_LONGEST);
985 write_exp_elt_longcst ((LONGEST) yyvsp[0].lval);
986 write_exp_elt_opcode (OP_LONG); ;
987 break;}
988 case 50:
989 #line 430 "../expread.y"
990 { YYSTYPE val;
991 parse_number (yyvsp[0].ssym.stoken.ptr, yyvsp[0].ssym.stoken.length, 0, &val);
992 write_exp_elt_opcode (OP_LONG);
993 if (val.lval == (int) val.lval ||
994 val.lval == (unsigned int) val.lval)
995 write_exp_elt_type (builtin_type_int);
996 else
997 write_exp_elt_type (BUILTIN_TYPE_LONGEST);
998 write_exp_elt_longcst (val.lval);
999 write_exp_elt_opcode (OP_LONG); ;
1000 break;}
1001 case 51:
1002 #line 443 "../expread.y"
1003 {
1004 write_exp_elt_opcode (OP_LONG);
1005 if (yyvsp[0].ulval == (unsigned int) yyvsp[0].ulval)
1006 write_exp_elt_type (builtin_type_unsigned_int);
1007 else
1008 write_exp_elt_type (BUILTIN_TYPE_UNSIGNED_LONGEST);
1009 write_exp_elt_longcst ((LONGEST) yyvsp[0].ulval);
1010 write_exp_elt_opcode (OP_LONG);
1011 ;
1012 break;}
1013 case 52:
1014 #line 455 "../expread.y"
1015 { YYSTYPE val;
1016 parse_number (yyvsp[0].ssym.stoken.ptr, yyvsp[0].ssym.stoken.length, 0, &val);
1017 write_exp_elt_opcode (OP_LONG);
1018 if (val.ulval == (unsigned int) val.ulval)
1019 write_exp_elt_type (builtin_type_unsigned_int);
1020 else
1021 write_exp_elt_type (BUILTIN_TYPE_UNSIGNED_LONGEST);
1022 write_exp_elt_longcst ((LONGEST)val.ulval);
1023 write_exp_elt_opcode (OP_LONG);
1024 ;
1025 break;}
1026 case 53:
1027 #line 468 "../expread.y"
1028 { write_exp_elt_opcode (OP_LONG);
1029 write_exp_elt_type (builtin_type_char);
1030 write_exp_elt_longcst ((LONGEST) yyvsp[0].lval);
1031 write_exp_elt_opcode (OP_LONG); ;
1032 break;}
1033 case 54:
1034 #line 475 "../expread.y"
1035 { write_exp_elt_opcode (OP_DOUBLE);
1036 write_exp_elt_type (builtin_type_double);
1037 write_exp_elt_dblcst (yyvsp[0].dval);
1038 write_exp_elt_opcode (OP_DOUBLE); ;
1039 break;}
1040 case 56:
1041 #line 485 "../expread.y"
1042 { write_exp_elt_opcode (OP_LAST);
1043 write_exp_elt_longcst ((LONGEST) yyvsp[0].lval);
1044 write_exp_elt_opcode (OP_LAST); ;
1045 break;}
1046 case 57:
1047 #line 491 "../expread.y"
1048 { write_exp_elt_opcode (OP_REGISTER);
1049 write_exp_elt_longcst ((LONGEST) yyvsp[0].lval);
1050 write_exp_elt_opcode (OP_REGISTER); ;
1051 break;}
1052 case 58:
1053 #line 497 "../expread.y"
1054 { write_exp_elt_opcode (OP_INTERNALVAR);
1055 write_exp_elt_intern (yyvsp[0].ivar);
1056 write_exp_elt_opcode (OP_INTERNALVAR); ;
1057 break;}
1058 case 59:
1059 #line 503 "../expread.y"
1060 { write_exp_elt_opcode (OP_LONG);
1061 write_exp_elt_type (builtin_type_int);
1062 write_exp_elt_longcst ((LONGEST) TYPE_LENGTH (yyvsp[-1].tval));
1063 write_exp_elt_opcode (OP_LONG); ;
1064 break;}
1065 case 60:
1066 #line 510 "../expread.y"
1067 { write_exp_elt_opcode (OP_STRING);
1068 write_exp_string (yyvsp[0].sval);
1069 write_exp_elt_opcode (OP_STRING); ;
1070 break;}
1071 case 61:
1072 #line 517 "../expread.y"
1073 { write_exp_elt_opcode (OP_THIS);
1074 write_exp_elt_opcode (OP_THIS); ;
1075 break;}
1076 case 62:
1077 #line 524 "../expread.y"
1078 {
1079 if (yyvsp[0].ssym.sym != 0)
1080 yyval.bval = SYMBOL_BLOCK_VALUE (yyvsp[0].ssym.sym);
1081 else
1082 {
1083 struct symtab *tem =
1084 lookup_symtab (copy_name (yyvsp[0].ssym.stoken));
1085 if (tem)
1086 yyval.bval = BLOCKVECTOR_BLOCK
1087 (BLOCKVECTOR (tem), STATIC_BLOCK);
1088 else
1089 error ("No file or function \"%s\".",
1090 copy_name (yyvsp[0].ssym.stoken));
1091 }
1092 ;
1093 break;}
1094 case 63:
1095 #line 542 "../expread.y"
1096 { struct symbol *tem
1097 = lookup_symbol (copy_name (yyvsp[0].sval), yyvsp[-2].bval,
1098 VAR_NAMESPACE, 0, NULL);
1099 if (!tem || SYMBOL_CLASS (tem) != LOC_BLOCK)
1100 error ("No function \"%s\" in specified context.",
1101 copy_name (yyvsp[0].sval));
1102 yyval.bval = SYMBOL_BLOCK_VALUE (tem); ;
1103 break;}
1104 case 64:
1105 #line 552 "../expread.y"
1106 { struct symbol *sym;
1107 sym = lookup_symbol (copy_name (yyvsp[0].sval), yyvsp[-2].bval,
1108 VAR_NAMESPACE, 0, NULL);
1109 if (sym == 0)
1110 error ("No symbol \"%s\" in specified context.",
1111 copy_name (yyvsp[0].sval));
1112 write_exp_elt_opcode (OP_VAR_VALUE);
1113 write_exp_elt_sym (sym);
1114 write_exp_elt_opcode (OP_VAR_VALUE); ;
1115 break;}
1116 case 65:
1117 #line 564 "../expread.y"
1118 {
1119 struct type *type = yyvsp[-2].tval;
1120 if (TYPE_CODE (type) != TYPE_CODE_STRUCT
1121 && TYPE_CODE (type) != TYPE_CODE_UNION)
1122 error ("`%s' is not defined as an aggregate type.",
1123 TYPE_NAME (type));
1124
1125 write_exp_elt_opcode (OP_SCOPE);
1126 write_exp_elt_type (type);
1127 write_exp_string (yyvsp[0].sval);
1128 write_exp_elt_opcode (OP_SCOPE);
1129 ;
1130 break;}
1131 case 66:
1132 #line 577 "../expread.y"
1133 {
1134 struct type *type = yyvsp[-3].tval;
1135 if (TYPE_CODE (type) != TYPE_CODE_STRUCT
1136 && TYPE_CODE (type) != TYPE_CODE_UNION)
1137 error ("`%s' is not defined as an aggregate type.",
1138 TYPE_NAME (type));
1139
1140 if (strcmp (type_name_no_tag (type), yyvsp[0].sval.ptr))
1141 error ("invalid destructor `%s::~%s'",
1142 type_name_no_tag (type), yyvsp[0].sval.ptr);
1143
1144 write_exp_elt_opcode (OP_SCOPE);
1145 write_exp_elt_type (type);
1146 write_exp_string (yyvsp[0].sval);
1147 write_exp_elt_opcode (OP_SCOPE);
1148 write_exp_elt_opcode (UNOP_LOGNOT);
1149 ;
1150 break;}
1151 case 67:
1152 #line 595 "../expread.y"
1153 {
1154 char *name = copy_name (yyvsp[0].sval);
1155 struct symbol *sym;
1156 int i;
1157
1158 sym =
1159 lookup_symbol (name, 0, VAR_NAMESPACE, 0, NULL);
1160 if (sym)
1161 {
1162 write_exp_elt_opcode (OP_VAR_VALUE);
1163 write_exp_elt_sym (sym);
1164 write_exp_elt_opcode (OP_VAR_VALUE);
1165 break;
1166 }
1167 for (i = 0; i < misc_function_count; i++)
1168 if (!strcmp (misc_function_vector[i].name, name))
1169 break;
1170
1171 if (i < misc_function_count)
1172 {
1173 enum misc_function_type mft =
1174 misc_function_vector[i].type;
1175
1176 write_exp_elt_opcode (OP_LONG);
1177 write_exp_elt_type (builtin_type_int);
1178 write_exp_elt_longcst ((LONGEST) misc_function_vector[i].address);
1179 write_exp_elt_opcode (OP_LONG);
1180 write_exp_elt_opcode (UNOP_MEMVAL);
1181 if (mft == mf_data || mft == mf_bss)
1182 write_exp_elt_type (builtin_type_int);
1183 else if (mft == mf_text)
1184 write_exp_elt_type (lookup_function_type (builtin_type_int));
1185 else
1186 write_exp_elt_type (builtin_type_char);
1187 write_exp_elt_opcode (UNOP_MEMVAL);
1188 }
1189 else
1190 if (symtab_list == 0
1191 && partial_symtab_list == 0)
1192 error ("No symbol table is loaded. Use the \"file\" command.");
1193 else
1194 error ("No symbol \"%s\" in current context.", name);
1195 ;
1196 break;}
1197 case 68:
1198 #line 641 "../expread.y"
1199 { struct symbol *sym = yyvsp[0].ssym.sym;
1200
1201 if (sym)
1202 {
1203 switch (sym->class)
1204 {
1205 case LOC_REGISTER:
1206 case LOC_ARG:
1207 case LOC_LOCAL:
1208 case LOC_LOCAL_ARG:
1209 if (innermost_block == 0 ||
1210 contained_in (block_found,
1211 innermost_block))
1212 innermost_block = block_found;
1213 }
1214 write_exp_elt_opcode (OP_VAR_VALUE);
1215 write_exp_elt_sym (sym);
1216 write_exp_elt_opcode (OP_VAR_VALUE);
1217 }
1218 else if (yyvsp[0].ssym.is_a_field_of_this)
1219 {
1220 /* C++: it hangs off of `this'. Must
1221 not inadvertently convert from a method call
1222 to data ref. */
1223 if (innermost_block == 0 ||
1224 contained_in (block_found, innermost_block))
1225 innermost_block = block_found;
1226 write_exp_elt_opcode (OP_THIS);
1227 write_exp_elt_opcode (OP_THIS);
1228 write_exp_elt_opcode (STRUCTOP_PTR);
1229 write_exp_string (yyvsp[0].ssym.stoken);
1230 write_exp_elt_opcode (STRUCTOP_PTR);
1231 }
1232 else
1233 {
1234 register int i;
1235 register char *arg = copy_name (yyvsp[0].ssym.stoken);
1236
1237 /* FIXME, this search is linear! At least
1238 optimize the strcmp with a 1-char cmp... */
1239 for (i = 0; i < misc_function_count; i++)
1240 if (!strcmp (misc_function_vector[i].name, arg))
1241 break;
1242
1243 if (i < misc_function_count)
1244 {
1245 enum misc_function_type mft =
1246 misc_function_vector[i].type;
1247
1248 write_exp_elt_opcode (OP_LONG);
1249 write_exp_elt_type (builtin_type_int);
1250 write_exp_elt_longcst ((LONGEST) misc_function_vector[i].address);
1251 write_exp_elt_opcode (OP_LONG);
1252 write_exp_elt_opcode (UNOP_MEMVAL);
1253 if (mft == mf_data || mft == mf_bss)
1254 write_exp_elt_type (builtin_type_int);
1255 else if (mft == mf_text)
1256 write_exp_elt_type (lookup_function_type (builtin_type_int));
1257 else
1258 write_exp_elt_type (builtin_type_char);
1259 write_exp_elt_opcode (UNOP_MEMVAL);
1260 }
1261 else if (symtab_list == 0
1262 && partial_symtab_list == 0)
1263 error ("No symbol table is loaded. Use the \"file\" command.");
1264 else
1265 error ("No symbol \"%s\" in current context.",
1266 copy_name (yyvsp[0].ssym.stoken));
1267 }
1268 ;
1269 break;}
1270 case 70:
1271 #line 716 "../expread.y"
1272 {
1273 /* This is where the interesting stuff happens. */
1274 int done = 0;
1275 int array_size;
1276 struct type *follow_type = yyvsp[-1].tval;
1277
1278 while (!done)
1279 switch (pop_type ())
1280 {
1281 case tp_end:
1282 done = 1;
1283 break;
1284 case tp_pointer:
1285 follow_type = lookup_pointer_type (follow_type);
1286 break;
1287 case tp_reference:
1288 follow_type = lookup_reference_type (follow_type);
1289 break;
1290 case tp_array:
1291 array_size = (int) pop_type ();
1292 if (array_size != -1)
1293 follow_type = create_array_type (follow_type,
1294 array_size);
1295 else
1296 follow_type = lookup_pointer_type (follow_type);
1297 break;
1298 case tp_function:
1299 follow_type = lookup_function_type (follow_type);
1300 break;
1301 }
1302 yyval.tval = follow_type;
1303 ;
1304 break;}
1305 case 71:
1306 #line 751 "../expread.y"
1307 { push_type (tp_pointer); yyval.voidval = 0; ;
1308 break;}
1309 case 72:
1310 #line 753 "../expread.y"
1311 { push_type (tp_pointer); yyval.voidval = yyvsp[0].voidval; ;
1312 break;}
1313 case 73:
1314 #line 755 "../expread.y"
1315 { push_type (tp_reference); yyval.voidval = 0; ;
1316 break;}
1317 case 74:
1318 #line 757 "../expread.y"
1319 { push_type (tp_reference); yyval.voidval = yyvsp[0].voidval; ;
1320 break;}
1321 case 76:
1322 #line 762 "../expread.y"
1323 { yyval.voidval = yyvsp[-1].voidval; ;
1324 break;}
1325 case 77:
1326 #line 764 "../expread.y"
1327 {
1328 push_type ((enum type_pieces) yyvsp[0].lval);
1329 push_type (tp_array);
1330 ;
1331 break;}
1332 case 78:
1333 #line 769 "../expread.y"
1334 {
1335 push_type ((enum type_pieces) yyvsp[0].lval);
1336 push_type (tp_array);
1337 yyval.voidval = 0;
1338 ;
1339 break;}
1340 case 79:
1341 #line 775 "../expread.y"
1342 { push_type (tp_function); ;
1343 break;}
1344 case 80:
1345 #line 777 "../expread.y"
1346 { push_type (tp_function); ;
1347 break;}
1348 case 81:
1349 #line 781 "../expread.y"
1350 { yyval.lval = -1; ;
1351 break;}
1352 case 82:
1353 #line 783 "../expread.y"
1354 { yyval.lval = yyvsp[-1].lval; ;
1355 break;}
1356 case 83:
1357 #line 787 "../expread.y"
1358 { yyval.voidval = 0; ;
1359 break;}
1360 case 85:
1361 #line 792 "../expread.y"
1362 { yyval.tval = lookup_member_type (builtin_type_int, yyvsp[-2].tval); ;
1363 break;}
1364 case 86:
1365 #line 794 "../expread.y"
1366 { yyval.tval = lookup_member_type (yyvsp[-5].tval, yyvsp[-3].tval); ;
1367 break;}
1368 case 87:
1369 #line 796 "../expread.y"
1370 { yyval.tval = lookup_member_type
1371 (lookup_function_type (yyvsp[-7].tval), yyvsp[-5].tval); ;
1372 break;}
1373 case 88:
1374 #line 799 "../expread.y"
1375 { yyval.tval = lookup_member_type
1376 (lookup_function_type (yyvsp[-8].tval), yyvsp[-6].tval);
1377 free (yyvsp[-1].tvec); ;
1378 break;}
1379 case 89:
1380 #line 806 "../expread.y"
1381 { yyval.tval = yyvsp[0].tsym.type; ;
1382 break;}
1383 case 90:
1384 #line 808 "../expread.y"
1385 { yyval.tval = builtin_type_int; ;
1386 break;}
1387 case 91:
1388 #line 810 "../expread.y"
1389 { yyval.tval = builtin_type_long; ;
1390 break;}
1391 case 92:
1392 #line 812 "../expread.y"
1393 { yyval.tval = builtin_type_short; ;
1394 break;}
1395 case 93:
1396 #line 814 "../expread.y"
1397 { yyval.tval = builtin_type_long; ;
1398 break;}
1399 case 94:
1400 #line 816 "../expread.y"
1401 { yyval.tval = builtin_type_unsigned_long; ;
1402 break;}
1403 case 95:
1404 #line 818 "../expread.y"
1405 { yyval.tval = builtin_type_long_long; ;
1406 break;}
1407 case 96:
1408 #line 820 "../expread.y"
1409 { yyval.tval = builtin_type_long_long; ;
1410 break;}
1411 case 97:
1412 #line 822 "../expread.y"
1413 { yyval.tval = builtin_type_unsigned_long_long; ;
1414 break;}
1415 case 98:
1416 #line 824 "../expread.y"
1417 { yyval.tval = builtin_type_unsigned_long_long; ;
1418 break;}
1419 case 99:
1420 #line 826 "../expread.y"
1421 { yyval.tval = builtin_type_short; ;
1422 break;}
1423 case 100:
1424 #line 828 "../expread.y"
1425 { yyval.tval = builtin_type_unsigned_short; ;
1426 break;}
1427 case 101:
1428 #line 830 "../expread.y"
1429 { yyval.tval = lookup_struct (copy_name (yyvsp[0].sval),
1430 expression_context_block); ;
1431 break;}
1432 case 102:
1433 #line 833 "../expread.y"
1434 { yyval.tval = lookup_union (copy_name (yyvsp[0].sval),
1435 expression_context_block); ;
1436 break;}
1437 case 103:
1438 #line 836 "../expread.y"
1439 { yyval.tval = lookup_enum (copy_name (yyvsp[0].sval),
1440 expression_context_block); ;
1441 break;}
1442 case 104:
1443 #line 839 "../expread.y"
1444 { yyval.tval = lookup_unsigned_typename (TYPE_NAME(yyvsp[0].tsym.type)); ;
1445 break;}
1446 case 105:
1447 #line 841 "../expread.y"
1448 { yyval.tval = builtin_type_unsigned_int; ;
1449 break;}
1450 case 106:
1451 #line 843 "../expread.y"
1452 { yyval.tval = yyvsp[0].tsym.type; ;
1453 break;}
1454 case 107:
1455 #line 845 "../expread.y"
1456 { yyval.tval = builtin_type_int; ;
1457 break;}
1458 case 109:
1459 #line 850 "../expread.y"
1460 {
1461 yyval.tsym.stoken.ptr = "int";
1462 yyval.tsym.stoken.length = 3;
1463 yyval.tsym.type = builtin_type_int;
1464 ;
1465 break;}
1466 case 110:
1467 #line 856 "../expread.y"
1468 {
1469 yyval.tsym.stoken.ptr = "long";
1470 yyval.tsym.stoken.length = 4;
1471 yyval.tsym.type = builtin_type_long;
1472 ;
1473 break;}
1474 case 111:
1475 #line 862 "../expread.y"
1476 {
1477 yyval.tsym.stoken.ptr = "short";
1478 yyval.tsym.stoken.length = 5;
1479 yyval.tsym.type = builtin_type_short;
1480 ;
1481 break;}
1482 case 112:
1483 #line 871 "../expread.y"
1484 { yyval.tvec = (struct type **)xmalloc (sizeof (struct type *) * 2);
1485 yyval.tvec[0] = (struct type *)0;
1486 yyval.tvec[1] = yyvsp[0].tval;
1487 ;
1488 break;}
1489 case 113:
1490 #line 876 "../expread.y"
1491 { int len = sizeof (struct type *) * ++(yyvsp[-2].ivec[0]);
1492 yyval.tvec = (struct type **)xrealloc (yyvsp[-2].tvec, len);
1493 yyval.tvec[yyval.ivec[0]] = yyvsp[0].tval;
1494 ;
1495 break;}
1496 case 114:
1497 #line 882 "../expread.y"
1498 { yyval.sval = yyvsp[0].ssym.stoken; ;
1499 break;}
1500 case 115:
1501 #line 883 "../expread.y"
1502 { yyval.sval = yyvsp[0].ssym.stoken; ;
1503 break;}
1504 case 116:
1505 #line 884 "../expread.y"
1506 { yyval.sval = yyvsp[0].tsym.stoken; ;
1507 break;}
1508 case 117:
1509 #line 885 "../expread.y"
1510 { yyval.sval = yyvsp[0].ssym.stoken; ;
1511 break;}
1512 case 118:
1513 #line 886 "../expread.y"
1514 { yyval.sval = yyvsp[0].ssym.stoken; ;
1515 break;}
1516 }
1517 /* the action file gets copied in in place of this dollarsign */
1518 #line 327 "bison.simple"
1519 \f
1520 yyvsp -= yylen;
1521 yyssp -= yylen;
1522 #ifdef YYLSP_NEEDED
1523 yylsp -= yylen;
1524 #endif
1525
1526 #if YYDEBUG != 0
1527 if (yydebug)
1528 {
1529 short *ssp1 = yyss - 1;
1530 fprintf (stderr, "state stack now");
1531 while (ssp1 != yyssp)
1532 fprintf (stderr, " %d", *++ssp1);
1533 fprintf (stderr, "\n");
1534 }
1535 #endif
1536
1537 *++yyvsp = yyval;
1538
1539 #ifdef YYLSP_NEEDED
1540 yylsp++;
1541 if (yylen == 0)
1542 {
1543 yylsp->first_line = yylloc.first_line;
1544 yylsp->first_column = yylloc.first_column;
1545 yylsp->last_line = (yylsp-1)->last_line;
1546 yylsp->last_column = (yylsp-1)->last_column;
1547 yylsp->text = 0;
1548 }
1549 else
1550 {
1551 yylsp->last_line = (yylsp+yylen-1)->last_line;
1552 yylsp->last_column = (yylsp+yylen-1)->last_column;
1553 }
1554 #endif
1555
1556 /* Now "shift" the result of the reduction.
1557 Determine what state that goes to,
1558 based on the state we popped back to
1559 and the rule number reduced by. */
1560
1561 yyn = yyr1[yyn];
1562
1563 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
1564 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1565 yystate = yytable[yystate];
1566 else
1567 yystate = yydefgoto[yyn - YYNTBASE];
1568
1569 goto yynewstate;
1570
1571 yyerrlab: /* here on detecting error */
1572
1573 if (! yyerrstatus)
1574 /* If not already recovering from an error, report this error. */
1575 {
1576 ++yynerrs;
1577 yyerror("parse error");
1578 }
1579
1580 if (yyerrstatus == 3)
1581 {
1582 /* if just tried and failed to reuse lookahead token after an error, discard it. */
1583
1584 /* return failure if at end of input */
1585 if (yychar == YYEOF)
1586 YYABORT;
1587
1588 #if YYDEBUG != 0
1589 if (yydebug)
1590 fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
1591 #endif
1592
1593 yychar = YYEMPTY;
1594 }
1595
1596 /* Else will try to reuse lookahead token
1597 after shifting the error token. */
1598
1599 yyerrstatus = 3; /* Each real token shifted decrements this */
1600
1601 goto yyerrhandle;
1602
1603 yyerrdefault: /* current state does not do anything special for the error token. */
1604
1605 #if 0
1606 /* This is wrong; only states that explicitly want error tokens
1607 should shift them. */
1608 yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
1609 if (yyn) goto yydefault;
1610 #endif
1611
1612 yyerrpop: /* pop the current state because it cannot handle the error token */
1613
1614 if (yyssp == yyss) YYABORT;
1615 yyvsp--;
1616 yystate = *--yyssp;
1617 #ifdef YYLSP_NEEDED
1618 yylsp--;
1619 #endif
1620
1621 #if YYDEBUG != 0
1622 if (yydebug)
1623 {
1624 short *ssp1 = yyss - 1;
1625 fprintf (stderr, "Error: state stack now");
1626 while (ssp1 != yyssp)
1627 fprintf (stderr, " %d", *++ssp1);
1628 fprintf (stderr, "\n");
1629 }
1630 #endif
1631
1632 yyerrhandle:
1633
1634 yyn = yypact[yystate];
1635 if (yyn == YYFLAG)
1636 goto yyerrdefault;
1637
1638 yyn += YYTERROR;
1639 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
1640 goto yyerrdefault;
1641
1642 yyn = yytable[yyn];
1643 if (yyn < 0)
1644 {
1645 if (yyn == YYFLAG)
1646 goto yyerrpop;
1647 yyn = -yyn;
1648 goto yyreduce;
1649 }
1650 else if (yyn == 0)
1651 goto yyerrpop;
1652
1653 if (yyn == YYFINAL)
1654 YYACCEPT;
1655
1656 #if YYDEBUG != 0
1657 if (yydebug)
1658 fprintf(stderr, "Shifting error token, ");
1659 #endif
1660
1661 *++yyvsp = yylval;
1662 #ifdef YYLSP_NEEDED
1663 *++yylsp = yylloc;
1664 #endif
1665
1666 yystate = yyn;
1667 goto yynewstate;
1668 }
1669 #line 901 "../expread.y"
1670
1671 \f
1672 /* Begin counting arguments for a function call,
1673 saving the data about any containing call. */
1674
1675 static void
1676 start_arglist ()
1677 {
1678 register struct funcall *new = (struct funcall *) xmalloc (sizeof (struct funcall));
1679
1680 new->next = funcall_chain;
1681 new->arglist_len = arglist_len;
1682 arglist_len = 0;
1683 funcall_chain = new;
1684 }
1685
1686 /* Return the number of arguments in a function call just terminated,
1687 and restore the data for the containing function call. */
1688
1689 static int
1690 end_arglist ()
1691 {
1692 register int val = arglist_len;
1693 register struct funcall *call = funcall_chain;
1694 funcall_chain = call->next;
1695 arglist_len = call->arglist_len;
1696 free (call);
1697 return val;
1698 }
1699
1700 /* Free everything in the funcall chain.
1701 Used when there is an error inside parsing. */
1702
1703 static void
1704 free_funcalls ()
1705 {
1706 register struct funcall *call, *next;
1707
1708 for (call = funcall_chain; call; call = next)
1709 {
1710 next = call->next;
1711 free (call);
1712 }
1713 }
1714 \f
1715 /* This page contains the functions for adding data to the struct expression
1716 being constructed. */
1717
1718 /* Add one element to the end of the expression. */
1719
1720 /* To avoid a bug in the Sun 4 compiler, we pass things that can fit into
1721 a register through here */
1722
1723 static void
1724 write_exp_elt (expelt)
1725 union exp_element expelt;
1726 {
1727 if (expout_ptr >= expout_size)
1728 {
1729 expout_size *= 2;
1730 expout = (struct expression *) xrealloc (expout,
1731 sizeof (struct expression)
1732 + expout_size * sizeof (union exp_element));
1733 }
1734 expout->elts[expout_ptr++] = expelt;
1735 }
1736
1737 static void
1738 write_exp_elt_opcode (expelt)
1739 enum exp_opcode expelt;
1740 {
1741 union exp_element tmp;
1742
1743 tmp.opcode = expelt;
1744
1745 write_exp_elt (tmp);
1746 }
1747
1748 static void
1749 write_exp_elt_sym (expelt)
1750 struct symbol *expelt;
1751 {
1752 union exp_element tmp;
1753
1754 tmp.symbol = expelt;
1755
1756 write_exp_elt (tmp);
1757 }
1758
1759 static void
1760 write_exp_elt_longcst (expelt)
1761 LONGEST expelt;
1762 {
1763 union exp_element tmp;
1764
1765 tmp.longconst = expelt;
1766
1767 write_exp_elt (tmp);
1768 }
1769
1770 static void
1771 write_exp_elt_dblcst (expelt)
1772 double expelt;
1773 {
1774 union exp_element tmp;
1775
1776 tmp.doubleconst = expelt;
1777
1778 write_exp_elt (tmp);
1779 }
1780
1781 static void
1782 write_exp_elt_type (expelt)
1783 struct type *expelt;
1784 {
1785 union exp_element tmp;
1786
1787 tmp.type = expelt;
1788
1789 write_exp_elt (tmp);
1790 }
1791
1792 static void
1793 write_exp_elt_intern (expelt)
1794 struct internalvar *expelt;
1795 {
1796 union exp_element tmp;
1797
1798 tmp.internalvar = expelt;
1799
1800 write_exp_elt (tmp);
1801 }
1802
1803 /* Add a string constant to the end of the expression.
1804 Follow it by its length in bytes, as a separate exp_element. */
1805
1806 static void
1807 write_exp_string (str)
1808 struct stoken str;
1809 {
1810 register int len = str.length;
1811 register int lenelt
1812 = (len + sizeof (union exp_element)) / sizeof (union exp_element);
1813
1814 expout_ptr += lenelt;
1815
1816 if (expout_ptr >= expout_size)
1817 {
1818 expout_size = max (expout_size * 2, expout_ptr + 10);
1819 expout = (struct expression *)
1820 xrealloc (expout, (sizeof (struct expression)
1821 + (expout_size * sizeof (union exp_element))));
1822 }
1823 bcopy (str.ptr, (char *) &expout->elts[expout_ptr - lenelt], len);
1824 ((char *) &expout->elts[expout_ptr - lenelt])[len] = 0;
1825 write_exp_elt_longcst ((LONGEST) len);
1826 }
1827 \f
1828 /* During parsing of a C expression, the pointer to the next character
1829 is in this variable. */
1830
1831 static char *lexptr;
1832
1833 /* Tokens that refer to names do so with explicit pointer and length,
1834 so they can share the storage that lexptr is parsing.
1835
1836 When it is necessary to pass a name to a function that expects
1837 a null-terminated string, the substring is copied out
1838 into a block of storage that namecopy points to.
1839
1840 namecopy is allocated once, guaranteed big enough, for each parsing. */
1841
1842 static char *namecopy;
1843
1844 /* Current depth in parentheses within the expression. */
1845
1846 static int paren_depth;
1847
1848 /* Nonzero means stop parsing on first comma (if not within parentheses). */
1849
1850 static int comma_terminates;
1851
1852 /* Take care of parsing a number (anything that starts with a digit).
1853 Set yylval and return the token type; update lexptr.
1854 LEN is the number of characters in it. */
1855
1856 /*** Needs some error checking for the float case ***/
1857
1858 static int
1859 parse_number (p, len, parsed_float, putithere)
1860 register char *p;
1861 register int len;
1862 int parsed_float;
1863 YYSTYPE *putithere;
1864 {
1865 register LONGEST n = 0;
1866 register int i;
1867 register int c;
1868 register int base = input_radix;
1869 int unsigned_p = 0;
1870
1871 extern double atof ();
1872
1873 if (parsed_float)
1874 {
1875 /* It's a float since it contains a point or an exponent. */
1876 putithere->dval = atof (p);
1877 return FLOAT;
1878 }
1879
1880 /* Handle base-switching prefixes 0x, 0t, 0d, 0 */
1881 if (p[0] == '0')
1882 switch (p[1])
1883 {
1884 case 'x':
1885 case 'X':
1886 if (len >= 3)
1887 {
1888 p += 2;
1889 base = 16;
1890 len -= 2;
1891 }
1892 break;
1893
1894 case 't':
1895 case 'T':
1896 case 'd':
1897 case 'D':
1898 if (len >= 3)
1899 {
1900 p += 2;
1901 base = 10;
1902 len -= 2;
1903 }
1904 break;
1905
1906 default:
1907 base = 8;
1908 break;
1909 }
1910
1911 while (len-- > 0)
1912 {
1913 c = *p++;
1914 if (c >= 'A' && c <= 'Z')
1915 c += 'a' - 'A';
1916 if (c != 'l' && c != 'u')
1917 n *= base;
1918 if (c >= '0' && c <= '9')
1919 n += i = c - '0';
1920 else
1921 {
1922 if (base > 10 && c >= 'a' && c <= 'f')
1923 n += i = c - 'a' + 10;
1924 else if (len == 0 && c == 'l')
1925 ;
1926 else if (len == 0 && c == 'u')
1927 unsigned_p = 1;
1928 else
1929 return ERROR; /* Char not a digit */
1930 }
1931 if (i >= base)
1932 return ERROR; /* Invalid digit in this base */
1933 }
1934
1935 if (unsigned_p)
1936 {
1937 putithere->ulval = n;
1938 return UINT;
1939 }
1940 else
1941 {
1942 putithere->lval = n;
1943 return INT;
1944 }
1945 }
1946
1947 struct token
1948 {
1949 char *operator;
1950 int token;
1951 enum exp_opcode opcode;
1952 };
1953
1954 const static struct token tokentab3[] =
1955 {
1956 {">>=", ASSIGN_MODIFY, BINOP_RSH},
1957 {"<<=", ASSIGN_MODIFY, BINOP_LSH}
1958 };
1959
1960 const static struct token tokentab2[] =
1961 {
1962 {"+=", ASSIGN_MODIFY, BINOP_ADD},
1963 {"-=", ASSIGN_MODIFY, BINOP_SUB},
1964 {"*=", ASSIGN_MODIFY, BINOP_MUL},
1965 {"/=", ASSIGN_MODIFY, BINOP_DIV},
1966 {"%=", ASSIGN_MODIFY, BINOP_REM},
1967 {"|=", ASSIGN_MODIFY, BINOP_LOGIOR},
1968 {"&=", ASSIGN_MODIFY, BINOP_LOGAND},
1969 {"^=", ASSIGN_MODIFY, BINOP_LOGXOR},
1970 {"++", INCREMENT, BINOP_END},
1971 {"--", DECREMENT, BINOP_END},
1972 {"->", ARROW, BINOP_END},
1973 {"&&", AND, BINOP_END},
1974 {"||", OR, BINOP_END},
1975 {"::", COLONCOLON, BINOP_END},
1976 {"<<", LSH, BINOP_END},
1977 {">>", RSH, BINOP_END},
1978 {"==", EQUAL, BINOP_END},
1979 {"!=", NOTEQUAL, BINOP_END},
1980 {"<=", LEQ, BINOP_END},
1981 {">=", GEQ, BINOP_END}
1982 };
1983
1984 /* assign machine-independent names to certain registers
1985 * (unless overridden by the REGISTER_NAMES table)
1986 */
1987 struct std_regs {
1988 char *name;
1989 int regnum;
1990 } std_regs[] = {
1991 #ifdef PC_REGNUM
1992 { "pc", PC_REGNUM },
1993 #endif
1994 #ifdef FP_REGNUM
1995 { "fp", FP_REGNUM },
1996 #endif
1997 #ifdef SP_REGNUM
1998 { "sp", SP_REGNUM },
1999 #endif
2000 #ifdef PS_REGNUM
2001 { "ps", PS_REGNUM },
2002 #endif
2003 };
2004
2005 #define NUM_STD_REGS (sizeof std_regs / sizeof std_regs[0])
2006
2007 /* Read one token, getting characters through lexptr. */
2008
2009 static int
2010 yylex ()
2011 {
2012 register int c;
2013 register int namelen;
2014 register unsigned i;
2015 register char *tokstart;
2016
2017 retry:
2018
2019 tokstart = lexptr;
2020 /* See if it is a special token of length 3. */
2021 for (i = 0; i < sizeof tokentab3 / sizeof tokentab3[0]; i++)
2022 if (!strncmp (tokstart, tokentab3[i].operator, 3))
2023 {
2024 lexptr += 3;
2025 yylval.opcode = tokentab3[i].opcode;
2026 return tokentab3[i].token;
2027 }
2028
2029 /* See if it is a special token of length 2. */
2030 for (i = 0; i < sizeof tokentab2 / sizeof tokentab2[0]; i++)
2031 if (!strncmp (tokstart, tokentab2[i].operator, 2))
2032 {
2033 lexptr += 2;
2034 yylval.opcode = tokentab2[i].opcode;
2035 return tokentab2[i].token;
2036 }
2037
2038 switch (c = *tokstart)
2039 {
2040 case 0:
2041 return 0;
2042
2043 case ' ':
2044 case '\t':
2045 case '\n':
2046 lexptr++;
2047 goto retry;
2048
2049 case '\'':
2050 lexptr++;
2051 c = *lexptr++;
2052 if (c == '\\')
2053 c = parse_escape (&lexptr);
2054 yylval.lval = c;
2055 c = *lexptr++;
2056 if (c != '\'')
2057 error ("Invalid character constant.");
2058 return CHAR;
2059
2060 case '(':
2061 paren_depth++;
2062 lexptr++;
2063 return c;
2064
2065 case ')':
2066 if (paren_depth == 0)
2067 return 0;
2068 paren_depth--;
2069 lexptr++;
2070 return c;
2071
2072 case ',':
2073 if (comma_terminates && paren_depth == 0)
2074 return 0;
2075 lexptr++;
2076 return c;
2077
2078 case '.':
2079 /* Might be a floating point number. */
2080 if (lexptr[1] < '0' || lexptr[1] > '9')
2081 goto symbol; /* Nope, must be a symbol. */
2082 /* FALL THRU into number case. */
2083
2084 case '0':
2085 case '1':
2086 case '2':
2087 case '3':
2088 case '4':
2089 case '5':
2090 case '6':
2091 case '7':
2092 case '8':
2093 case '9':
2094 {
2095 /* It's a number. */
2096 int got_dot = 0, got_e = 0, toktype;
2097 register char *p = tokstart;
2098 int hex = input_radix > 10;
2099
2100 if (c == '0' && (p[1] == 'x' || p[1] == 'X'))
2101 {
2102 p += 2;
2103 hex = 1;
2104 }
2105 else if (c == '0' && (p[1]=='t' || p[1]=='T' || p[1]=='d' || p[1]=='D'))
2106 {
2107 p += 2;
2108 hex = 0;
2109 }
2110
2111 for (;; ++p)
2112 {
2113 if (!hex && !got_e && (*p == 'e' || *p == 'E'))
2114 got_dot = got_e = 1;
2115 else if (!hex && !got_dot && *p == '.')
2116 got_dot = 1;
2117 else if (got_e && (p[-1] == 'e' || p[-1] == 'E')
2118 && (*p == '-' || *p == '+'))
2119 /* This is the sign of the exponent, not the end of the
2120 number. */
2121 continue;
2122 /* We will take any letters or digits. parse_number will
2123 complain if past the radix, or if L or U are not final. */
2124 else if ((*p < '0' || *p > '9')
2125 && ((*p < 'a' || *p > 'z')
2126 && (*p < 'A' || *p > 'Z')))
2127 break;
2128 }
2129 toktype = parse_number (tokstart, p - tokstart, got_dot|got_e, &yylval);
2130 if (toktype == ERROR)
2131 {
2132 char *err_copy = (char *) alloca (p - tokstart + 1);
2133
2134 bcopy (tokstart, err_copy, p - tokstart);
2135 err_copy[p - tokstart] = 0;
2136 error ("Invalid number \"%s\".", err_copy);
2137 }
2138 lexptr = p;
2139 return toktype;
2140 }
2141
2142 case '+':
2143 case '-':
2144 case '*':
2145 case '/':
2146 case '%':
2147 case '|':
2148 case '&':
2149 case '^':
2150 case '~':
2151 case '!':
2152 case '@':
2153 case '<':
2154 case '>':
2155 case '[':
2156 case ']':
2157 case '?':
2158 case ':':
2159 case '=':
2160 case '{':
2161 case '}':
2162 symbol:
2163 lexptr++;
2164 return c;
2165
2166 case '"':
2167 for (namelen = 1; (c = tokstart[namelen]) != '"'; namelen++)
2168 if (c == '\\')
2169 {
2170 c = tokstart[++namelen];
2171 if (c >= '0' && c <= '9')
2172 {
2173 c = tokstart[++namelen];
2174 if (c >= '0' && c <= '9')
2175 c = tokstart[++namelen];
2176 }
2177 }
2178 yylval.sval.ptr = tokstart + 1;
2179 yylval.sval.length = namelen - 1;
2180 lexptr += namelen + 1;
2181 return STRING;
2182 }
2183
2184 if (!(c == '_' || c == '$'
2185 || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')))
2186 /* We must have come across a bad character (e.g. ';'). */
2187 error ("Invalid character '%c' in expression.", c);
2188
2189 /* It's a name. See how long it is. */
2190 namelen = 0;
2191 for (c = tokstart[namelen];
2192 (c == '_' || c == '$' || (c >= '0' && c <= '9')
2193 || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'));
2194 c = tokstart[++namelen])
2195 ;
2196
2197 /* The token "if" terminates the expression and is NOT
2198 removed from the input stream. */
2199 if (namelen == 2 && tokstart[0] == 'i' && tokstart[1] == 'f')
2200 {
2201 return 0;
2202 }
2203
2204 lexptr += namelen;
2205
2206 /* Handle the tokens $digits; also $ (short for $0) and $$ (short for $$1)
2207 and $$digits (equivalent to $<-digits> if you could type that).
2208 Make token type LAST, and put the number (the digits) in yylval. */
2209
2210 if (*tokstart == '$')
2211 {
2212 register int negate = 0;
2213 c = 1;
2214 /* Double dollar means negate the number and add -1 as well.
2215 Thus $$ alone means -1. */
2216 if (namelen >= 2 && tokstart[1] == '$')
2217 {
2218 negate = 1;
2219 c = 2;
2220 }
2221 if (c == namelen)
2222 {
2223 /* Just dollars (one or two) */
2224 yylval.lval = - negate;
2225 return LAST;
2226 }
2227 /* Is the rest of the token digits? */
2228 for (; c < namelen; c++)
2229 if (!(tokstart[c] >= '0' && tokstart[c] <= '9'))
2230 break;
2231 if (c == namelen)
2232 {
2233 yylval.lval = atoi (tokstart + 1 + negate);
2234 if (negate)
2235 yylval.lval = - yylval.lval;
2236 return LAST;
2237 }
2238 }
2239
2240 /* Handle tokens that refer to machine registers:
2241 $ followed by a register name. */
2242
2243 if (*tokstart == '$') {
2244 for (c = 0; c < NUM_REGS; c++)
2245 if (namelen - 1 == strlen (reg_names[c])
2246 && !strncmp (tokstart + 1, reg_names[c], namelen - 1))
2247 {
2248 yylval.lval = c;
2249 return REGNAME;
2250 }
2251 for (c = 0; c < NUM_STD_REGS; c++)
2252 if (namelen - 1 == strlen (std_regs[c].name)
2253 && !strncmp (tokstart + 1, std_regs[c].name, namelen - 1))
2254 {
2255 yylval.lval = std_regs[c].regnum;
2256 return REGNAME;
2257 }
2258 }
2259 /* Catch specific keywords. Should be done with a data structure. */
2260 switch (namelen)
2261 {
2262 case 8:
2263 if (!strncmp (tokstart, "unsigned", 8))
2264 return UNSIGNED;
2265 break;
2266 case 6:
2267 if (!strncmp (tokstart, "struct", 6))
2268 return STRUCT;
2269 if (!strncmp (tokstart, "signed", 6))
2270 return SIGNED;
2271 if (!strncmp (tokstart, "sizeof", 6))
2272 return SIZEOF;
2273 break;
2274 case 5:
2275 if (!strncmp (tokstart, "union", 5))
2276 return UNION;
2277 if (!strncmp (tokstart, "short", 5))
2278 return SHORT;
2279 break;
2280 case 4:
2281 if (!strncmp (tokstart, "enum", 4))
2282 return ENUM;
2283 if (!strncmp (tokstart, "long", 4))
2284 return LONG;
2285 if (!strncmp (tokstart, "this", 4))
2286 {
2287 static const char this_name[] =
2288 { CPLUS_MARKER, 't', 'h', 'i', 's', '\0' };
2289
2290 if (lookup_symbol (this_name, expression_context_block,
2291 VAR_NAMESPACE, 0, NULL))
2292 return THIS;
2293 }
2294 break;
2295 case 3:
2296 if (!strncmp (tokstart, "int", 3))
2297 return INT_KEYWORD;
2298 break;
2299 default:
2300 break;
2301 }
2302
2303 yylval.sval.ptr = tokstart;
2304 yylval.sval.length = namelen;
2305
2306 /* Any other names starting in $ are debugger internal variables. */
2307
2308 if (*tokstart == '$')
2309 {
2310 yylval.ivar = lookup_internalvar (copy_name (yylval.sval) + 1);
2311 return VARIABLE;
2312 }
2313
2314 /* Use token-type BLOCKNAME for symbols that happen to be defined as
2315 functions or symtabs. If this is not so, then ...
2316 Use token-type TYPENAME for symbols that happen to be defined
2317 currently as names of types; NAME for other symbols.
2318 The caller is not constrained to care about the distinction. */
2319 {
2320 char *tmp = copy_name (yylval.sval);
2321 struct symbol *sym;
2322 int is_a_field_of_this = 0;
2323 int hextype;
2324
2325 sym = lookup_symbol (tmp, expression_context_block,
2326 VAR_NAMESPACE, &is_a_field_of_this, NULL);
2327 if ((sym && SYMBOL_CLASS (sym) == LOC_BLOCK) ||
2328 lookup_partial_symtab (tmp))
2329 {
2330 yylval.ssym.sym = sym;
2331 yylval.ssym.is_a_field_of_this = is_a_field_of_this;
2332 return BLOCKNAME;
2333 }
2334 if (sym && SYMBOL_CLASS (sym) == LOC_TYPEDEF)
2335 {
2336 yylval.tsym.type = SYMBOL_TYPE (sym);
2337 return TYPENAME;
2338 }
2339 if ((yylval.tsym.type = lookup_primitive_typename (tmp)) != 0)
2340 return TYPENAME;
2341
2342 /* Input names that aren't symbols but ARE valid hex numbers,
2343 when the input radix permits them, can be names or numbers
2344 depending on the parse. Note we support radixes > 16 here. */
2345 if (!sym &&
2346 ((tokstart[0] >= 'a' && tokstart[0] < 'a' + input_radix - 10) ||
2347 (tokstart[0] >= 'A' && tokstart[0] < 'A' + input_radix - 10)))
2348 {
2349 YYSTYPE newlval; /* Its value is ignored. */
2350 hextype = parse_number (tokstart, namelen, 0, &newlval);
2351 if (hextype == INT)
2352 {
2353 yylval.ssym.sym = sym;
2354 yylval.ssym.is_a_field_of_this = is_a_field_of_this;
2355 return NAME_OR_INT;
2356 }
2357 if (hextype == UINT)
2358 {
2359 yylval.ssym.sym = sym;
2360 yylval.ssym.is_a_field_of_this = is_a_field_of_this;
2361 return NAME_OR_UINT;
2362 }
2363 }
2364
2365 /* Any other kind of symbol */
2366 yylval.ssym.sym = sym;
2367 yylval.ssym.is_a_field_of_this = is_a_field_of_this;
2368 return NAME;
2369 }
2370 }
2371
2372 static void
2373 yyerror (msg)
2374 char *msg;
2375 {
2376 error ("Invalid syntax in expression.");
2377 }
2378
2379 /* Return a null-terminated temporary copy of the name
2380 of a string token. */
2381
2382 static char *
2383 copy_name (token)
2384 struct stoken token;
2385 {
2386 bcopy (token.ptr, namecopy, token.length);
2387 namecopy[token.length] = 0;
2388 return namecopy;
2389 }
2390 \f
2391 /* Reverse an expression from suffix form (in which it is constructed)
2392 to prefix form (in which we can conveniently print or execute it). */
2393
2394 static void prefixify_subexp ();
2395
2396 static void
2397 prefixify_expression (expr)
2398 register struct expression *expr;
2399 {
2400 register int len = sizeof (struct expression) +
2401 expr->nelts * sizeof (union exp_element);
2402 register struct expression *temp;
2403 register int inpos = expr->nelts, outpos = 0;
2404
2405 temp = (struct expression *) alloca (len);
2406
2407 /* Copy the original expression into temp. */
2408 bcopy (expr, temp, len);
2409
2410 prefixify_subexp (temp, expr, inpos, outpos);
2411 }
2412
2413 /* Return the number of exp_elements in the subexpression of EXPR
2414 whose last exp_element is at index ENDPOS - 1 in EXPR. */
2415
2416 static int
2417 length_of_subexp (expr, endpos)
2418 register struct expression *expr;
2419 register int endpos;
2420 {
2421 register int oplen = 1;
2422 register int args = 0;
2423 register int i;
2424
2425 if (endpos < 0)
2426 error ("?error in length_of_subexp");
2427
2428 i = (int) expr->elts[endpos - 1].opcode;
2429
2430 switch (i)
2431 {
2432 /* C++ */
2433 case OP_SCOPE:
2434 oplen = 4 + ((expr->elts[endpos - 2].longconst
2435 + sizeof (union exp_element))
2436 / sizeof (union exp_element));
2437 break;
2438
2439 case OP_LONG:
2440 case OP_DOUBLE:
2441 oplen = 4;
2442 break;
2443
2444 case OP_VAR_VALUE:
2445 case OP_LAST:
2446 case OP_REGISTER:
2447 case OP_INTERNALVAR:
2448 oplen = 3;
2449 break;
2450
2451 case OP_FUNCALL:
2452 oplen = 3;
2453 args = 1 + expr->elts[endpos - 2].longconst;
2454 break;
2455
2456 case UNOP_CAST:
2457 case UNOP_MEMVAL:
2458 oplen = 3;
2459 args = 1;
2460 break;
2461
2462 case STRUCTOP_STRUCT:
2463 case STRUCTOP_PTR:
2464 args = 1;
2465 case OP_STRING:
2466 oplen = 3 + ((expr->elts[endpos - 2].longconst
2467 + sizeof (union exp_element))
2468 / sizeof (union exp_element));
2469 break;
2470
2471 case TERNOP_COND:
2472 args = 3;
2473 break;
2474
2475 case BINOP_ASSIGN_MODIFY:
2476 oplen = 3;
2477 args = 2;
2478 break;
2479
2480 /* C++ */
2481 case OP_THIS:
2482 oplen = 2;
2483 break;
2484
2485 default:
2486 args = 1 + (i < (int) BINOP_END);
2487 }
2488
2489 while (args > 0)
2490 {
2491 oplen += length_of_subexp (expr, endpos - oplen);
2492 args--;
2493 }
2494
2495 return oplen;
2496 }
2497
2498 /* Copy the subexpression ending just before index INEND in INEXPR
2499 into OUTEXPR, starting at index OUTBEG.
2500 In the process, convert it from suffix to prefix form. */
2501
2502 static void
2503 prefixify_subexp (inexpr, outexpr, inend, outbeg)
2504 register struct expression *inexpr;
2505 struct expression *outexpr;
2506 register int inend;
2507 int outbeg;
2508 {
2509 register int oplen = 1;
2510 register int args = 0;
2511 register int i;
2512 int *arglens;
2513 enum exp_opcode opcode;
2514
2515 /* Compute how long the last operation is (in OPLEN),
2516 and also how many preceding subexpressions serve as
2517 arguments for it (in ARGS). */
2518
2519 opcode = inexpr->elts[inend - 1].opcode;
2520 switch (opcode)
2521 {
2522 /* C++ */
2523 case OP_SCOPE:
2524 oplen = 4 + ((inexpr->elts[inend - 2].longconst
2525 + sizeof (union exp_element))
2526 / sizeof (union exp_element));
2527 break;
2528
2529 case OP_LONG:
2530 case OP_DOUBLE:
2531 oplen = 4;
2532 break;
2533
2534 case OP_VAR_VALUE:
2535 case OP_LAST:
2536 case OP_REGISTER:
2537 case OP_INTERNALVAR:
2538 oplen = 3;
2539 break;
2540
2541 case OP_FUNCALL:
2542 oplen = 3;
2543 args = 1 + inexpr->elts[inend - 2].longconst;
2544 break;
2545
2546 case UNOP_CAST:
2547 case UNOP_MEMVAL:
2548 oplen = 3;
2549 args = 1;
2550 break;
2551
2552 case STRUCTOP_STRUCT:
2553 case STRUCTOP_PTR:
2554 args = 1;
2555 case OP_STRING:
2556 oplen = 3 + ((inexpr->elts[inend - 2].longconst
2557 + sizeof (union exp_element))
2558 / sizeof (union exp_element));
2559
2560 break;
2561
2562 case TERNOP_COND:
2563 args = 3;
2564 break;
2565
2566 case BINOP_ASSIGN_MODIFY:
2567 oplen = 3;
2568 args = 2;
2569 break;
2570
2571 /* C++ */
2572 case OP_THIS:
2573 oplen = 2;
2574 break;
2575
2576 default:
2577 args = 1 + ((int) opcode < (int) BINOP_END);
2578 }
2579
2580 /* Copy the final operator itself, from the end of the input
2581 to the beginning of the output. */
2582 inend -= oplen;
2583 bcopy (&inexpr->elts[inend], &outexpr->elts[outbeg],
2584 oplen * sizeof (union exp_element));
2585 outbeg += oplen;
2586
2587 /* Find the lengths of the arg subexpressions. */
2588 arglens = (int *) alloca (args * sizeof (int));
2589 for (i = args - 1; i >= 0; i--)
2590 {
2591 oplen = length_of_subexp (inexpr, inend);
2592 arglens[i] = oplen;
2593 inend -= oplen;
2594 }
2595
2596 /* Now copy each subexpression, preserving the order of
2597 the subexpressions, but prefixifying each one.
2598 In this loop, inend starts at the beginning of
2599 the expression this level is working on
2600 and marches forward over the arguments.
2601 outbeg does similarly in the output. */
2602 for (i = 0; i < args; i++)
2603 {
2604 oplen = arglens[i];
2605 inend += oplen;
2606 prefixify_subexp (inexpr, outexpr, inend, outbeg);
2607 outbeg += oplen;
2608 }
2609 }
2610 \f
2611 /* This page contains the two entry points to this file. */
2612
2613 /* Read a C expression from the string *STRINGPTR points to,
2614 parse it, and return a pointer to a struct expression that we malloc.
2615 Use block BLOCK as the lexical context for variable names;
2616 if BLOCK is zero, use the block of the selected stack frame.
2617 Meanwhile, advance *STRINGPTR to point after the expression,
2618 at the first nonwhite character that is not part of the expression
2619 (possibly a null character).
2620
2621 If COMMA is nonzero, stop if a comma is reached. */
2622
2623 struct expression *
2624 parse_c_1 (stringptr, block, comma)
2625 char **stringptr;
2626 struct block *block;
2627 int comma;
2628 {
2629 struct cleanup *old_chain;
2630
2631 lexptr = *stringptr;
2632
2633 paren_depth = 0;
2634 type_stack_depth = 0;
2635
2636 comma_terminates = comma;
2637
2638 if (lexptr == 0 || *lexptr == 0)
2639 error_no_arg ("expression to compute");
2640
2641 old_chain = make_cleanup (free_funcalls, 0);
2642 funcall_chain = 0;
2643
2644 expression_context_block = block ? block : get_selected_block ();
2645
2646 namecopy = (char *) alloca (strlen (lexptr) + 1);
2647 expout_size = 10;
2648 expout_ptr = 0;
2649 expout = (struct expression *)
2650 xmalloc (sizeof (struct expression)
2651 + expout_size * sizeof (union exp_element));
2652 make_cleanup (free_current_contents, &expout);
2653 if (yyparse ())
2654 yyerror (NULL);
2655 discard_cleanups (old_chain);
2656 expout->nelts = expout_ptr;
2657 expout = (struct expression *)
2658 xrealloc (expout,
2659 sizeof (struct expression)
2660 + expout_ptr * sizeof (union exp_element));
2661 prefixify_expression (expout);
2662 *stringptr = lexptr;
2663 return expout;
2664 }
2665
2666 /* Parse STRING as an expression, and complain if this fails
2667 to use up all of the contents of STRING. */
2668
2669 struct expression *
2670 parse_c_expression (string)
2671 char *string;
2672 {
2673 register struct expression *exp;
2674 exp = parse_c_1 (&string, 0, 0);
2675 if (*string)
2676 error ("Junk after end of expression.");
2677 return exp;
2678 }
2679
2680 static void
2681 push_type (tp)
2682 enum type_pieces tp;
2683 {
2684 if (type_stack_depth == type_stack_size)
2685 {
2686 type_stack_size *= 2;
2687 type_stack = (enum type_pieces *)
2688 xrealloc (type_stack, type_stack_size * sizeof (enum type_pieces));
2689 }
2690 type_stack[type_stack_depth++] = tp;
2691 }
2692
2693 static enum type_pieces
2694 pop_type ()
2695 {
2696 if (type_stack_depth)
2697 return type_stack[--type_stack_depth];
2698 return tp_end;
2699 }
2700
2701 void
2702 _initialize_expread ()
2703 {
2704 type_stack_size = 80;
2705 type_stack_depth = 0;
2706 type_stack = (enum type_pieces *)
2707 xmalloc (type_stack_size * sizeof (enum type_pieces));
2708 }
This page took 0.097625 seconds and 4 git commands to generate.