1 /* YACC parser for Ada expressions, for GDB.
2 Copyright (C) 1986, 1989, 1990, 1991, 1993, 1994, 1997, 2000, 2003,
3 2004 Free Software Foundation, Inc.
5 This file is part of GDB.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
21 /* Parse an Ada expression from text in a string,
22 and return the result as a struct expression pointer.
23 That structure contains arithmetic operations in reverse polish,
24 with constants represented by operations that are followed by special data.
25 See expression.h for the details of the format.
26 What is important here is that it can be built up sequentially
27 during the process of parsing; the lower levels of the tree always
28 come first in the result.
30 malloc's and realloc's in this file are transformed to
31 xmalloc and xrealloc respectively by the same sed command in the
32 makefile that remaps any other malloc/realloc inserted by the parser
33 generator. Doing this with #defines and trying to control the interaction
34 with include files (<malloc.h> and <stdlib.h> for example) just became
35 too messy, particularly when such includes can be inserted at random
36 times by the parser generator. */
41 #include "gdb_string.h"
43 #include "expression.h"
45 #include "parser-defs.h"
48 #include "bfd.h" /* Required by objfiles.h. */
49 #include "symfile.h" /* Required by objfiles.h. */
50 #include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
54 /* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
55 as well as gratuitiously global symbol names, so we can have multiple
56 yacc generated parsers in gdb. These are only the variables
57 produced by yacc. If other parser generators (bison, byacc, etc) produce
58 additional global names that conflict at link time, then those parser
59 generators need to be fixed instead of adding those names to this list. */
61 /* NOTE: This is clumsy, especially since BISON and FLEX provide --prefix
62 options. I presume we are maintaining it to accommodate systems
63 without BISON? (PNH) */
65 #define yymaxdepth ada_maxdepth
66 #define yyparse _ada_parse /* ada_parse calls this after initialization */
68 #define yyerror ada_error
69 #define yylval ada_lval
70 #define yychar ada_char
71 #define yydebug ada_debug
72 #define yypact ada_pact
79 #define yyexca ada_exca
80 #define yyerrflag ada_errflag
81 #define yynerrs ada_nerrs
85 #define yy_yys ada_yys
86 #define yystate ada_state
89 #define yy_yyv ada_yyv
91 #define yylloc ada_lloc
92 #define yyreds ada_reds /* With YYDEBUG defined */
93 #define yytoks ada_toks /* With YYDEBUG defined */
94 #define yyname ada_name /* With YYDEBUG defined */
95 #define yyrule ada_rule /* With YYDEBUG defined */
98 #define YYDEBUG 1 /* Default to yydebug support */
101 #define YYFPRINTF parser_fprintf
105 struct minimal_symbol *msym;
107 struct stoken stoken;
110 /* If expression is in the context of TYPE'(...), then TYPE, else
112 static struct type *type_qualifier;
116 static int yylex (void);
118 void yyerror (char *);
120 static struct stoken string_to_operator (struct stoken);
122 static void write_int (LONGEST, struct type *);
124 static void write_object_renaming (struct block *, struct symbol *, int);
126 static void write_var_from_name (struct block *, struct name_info);
128 static LONGEST convert_char_literal (struct type *, LONGEST);
144 struct name_info ssym;
147 struct internalvar *ivar;
151 %type <voidval> exp exp1 simple_exp start variable
154 %token <typed_val> INT NULL_PTR CHARLIT
155 %token <typed_val_float> FLOAT
156 %token <tval> TYPENAME
157 %token <bval> BLOCKNAME
159 /* Both NAME and TYPENAME tokens represent symbols in the input,
160 and both convey their data as strings.
161 But a TYPENAME is a string that happens to be defined as a typedef
162 or builtin type name (such as int or char)
163 and a NAME is any other symbol.
164 Contexts where this distinction is not important can use the
165 nonterminal "name", which matches either NAME or TYPENAME. */
168 %token <ssym> NAME DOT_ID OBJECT_RENAMING
170 %type <lval> arglist tick_arglist
172 %type <tval> save_qualifier
176 /* Special type cases, put in to allow the parser to distinguish different
178 %token <sval> SPECIAL_VARIABLE
181 %left _AND_ OR XOR THEN ELSE
182 %left '=' NOTEQUAL '<' '>' LEQ GEQ IN DOTDOT
186 %left '*' '/' MOD REM
187 %right STARSTAR ABS NOT
188 /* The following are right-associative only so that reductions at this
189 precedence have lower precedence than '.' and '('. The syntax still
190 forces a.b.c, e.g., to be LEFT-associated. */
191 %right TICK_ACCESS TICK_ADDRESS TICK_FIRST TICK_LAST TICK_LENGTH
192 %right TICK_MAX TICK_MIN TICK_MODULUS
193 %right TICK_POS TICK_RANGE TICK_SIZE TICK_TAG TICK_VAL
194 %right '.' '(' '[' DOT_ID DOT_ALL
202 | type { write_exp_elt_opcode (OP_TYPE);
203 write_exp_elt_type ($1);
204 write_exp_elt_opcode (OP_TYPE); }
207 /* Expressions, including the sequencing operator. */
210 { write_exp_elt_opcode (BINOP_COMMA); }
213 /* Expressions, not including the sequencing operator. */
214 simple_exp : simple_exp DOT_ALL
215 { write_exp_elt_opcode (UNOP_IND); }
218 simple_exp : simple_exp DOT_ID
219 { write_exp_elt_opcode (STRUCTOP_STRUCT);
220 write_exp_string ($2.stoken);
221 write_exp_elt_opcode (STRUCTOP_STRUCT);
225 simple_exp : simple_exp '(' arglist ')'
227 write_exp_elt_opcode (OP_FUNCALL);
228 write_exp_elt_longcst ($3);
229 write_exp_elt_opcode (OP_FUNCALL);
233 simple_exp : type '(' exp ')'
235 write_exp_elt_opcode (UNOP_CAST);
236 write_exp_elt_type ($1);
237 write_exp_elt_opcode (UNOP_CAST);
241 simple_exp : type '\'' save_qualifier { type_qualifier = $1; } '(' exp ')'
243 write_exp_elt_opcode (UNOP_QUAL);
244 write_exp_elt_type ($1);
245 write_exp_elt_opcode (UNOP_QUAL);
250 save_qualifier : { $$ = type_qualifier; }
254 simple_exp '(' exp DOTDOT exp ')'
255 { write_exp_elt_opcode (TERNOP_SLICE); }
258 simple_exp : '(' exp1 ')' { }
261 simple_exp : variable
264 simple_exp: SPECIAL_VARIABLE /* Various GDB extensions */
265 { write_dollar_variable ($1); }
271 exp : exp ASSIGN exp /* Extension for convenience */
272 { write_exp_elt_opcode (BINOP_ASSIGN); }
275 exp : '-' exp %prec UNARY
276 { write_exp_elt_opcode (UNOP_NEG); }
279 exp : '+' exp %prec UNARY
280 { write_exp_elt_opcode (UNOP_PLUS); }
283 exp : NOT exp %prec UNARY
284 { write_exp_elt_opcode (UNOP_LOGICAL_NOT); }
287 exp : ABS exp %prec UNARY
288 { write_exp_elt_opcode (UNOP_ABS); }
291 arglist : { $$ = 0; }
300 | arglist ',' any_name ARROW exp
304 exp : '{' type '}' exp %prec '.'
306 { write_exp_elt_opcode (UNOP_MEMVAL);
307 write_exp_elt_type ($2);
308 write_exp_elt_opcode (UNOP_MEMVAL);
312 /* Binary operators in order of decreasing precedence. */
314 exp : exp STARSTAR exp
315 { write_exp_elt_opcode (BINOP_EXP); }
319 { write_exp_elt_opcode (BINOP_MUL); }
323 { write_exp_elt_opcode (BINOP_DIV); }
326 exp : exp REM exp /* May need to be fixed to give correct Ada REM */
327 { write_exp_elt_opcode (BINOP_REM); }
331 { write_exp_elt_opcode (BINOP_MOD); }
334 exp : exp '@' exp /* GDB extension */
335 { write_exp_elt_opcode (BINOP_REPEAT); }
339 { write_exp_elt_opcode (BINOP_ADD); }
343 { write_exp_elt_opcode (BINOP_CONCAT); }
347 { write_exp_elt_opcode (BINOP_SUB); }
351 { write_exp_elt_opcode (BINOP_EQUAL); }
354 exp : exp NOTEQUAL exp
355 { write_exp_elt_opcode (BINOP_NOTEQUAL); }
359 { write_exp_elt_opcode (BINOP_LEQ); }
362 exp : exp IN exp DOTDOT exp
363 { write_exp_elt_opcode (TERNOP_IN_RANGE); }
364 | exp IN exp TICK_RANGE tick_arglist
365 { write_exp_elt_opcode (BINOP_IN_BOUNDS);
366 write_exp_elt_longcst ((LONGEST) $5);
367 write_exp_elt_opcode (BINOP_IN_BOUNDS);
369 | exp IN TYPENAME %prec TICK_ACCESS
370 { write_exp_elt_opcode (UNOP_IN_RANGE);
371 write_exp_elt_type ($3);
372 write_exp_elt_opcode (UNOP_IN_RANGE);
374 | exp NOT IN exp DOTDOT exp
375 { write_exp_elt_opcode (TERNOP_IN_RANGE);
376 write_exp_elt_opcode (UNOP_LOGICAL_NOT);
378 | exp NOT IN exp TICK_RANGE tick_arglist
379 { write_exp_elt_opcode (BINOP_IN_BOUNDS);
380 write_exp_elt_longcst ((LONGEST) $6);
381 write_exp_elt_opcode (BINOP_IN_BOUNDS);
382 write_exp_elt_opcode (UNOP_LOGICAL_NOT);
384 | exp NOT IN TYPENAME %prec TICK_ACCESS
385 { write_exp_elt_opcode (UNOP_IN_RANGE);
386 write_exp_elt_type ($4);
387 write_exp_elt_opcode (UNOP_IN_RANGE);
388 write_exp_elt_opcode (UNOP_LOGICAL_NOT);
393 { write_exp_elt_opcode (BINOP_GEQ); }
397 { write_exp_elt_opcode (BINOP_LESS); }
401 { write_exp_elt_opcode (BINOP_GTR); }
404 exp : exp _AND_ exp /* Fix for Ada elementwise AND. */
405 { write_exp_elt_opcode (BINOP_BITWISE_AND); }
408 exp : exp _AND_ THEN exp %prec _AND_
409 { write_exp_elt_opcode (BINOP_LOGICAL_AND); }
412 exp : exp OR exp /* Fix for Ada elementwise OR */
413 { write_exp_elt_opcode (BINOP_BITWISE_IOR); }
416 exp : exp OR ELSE exp
417 { write_exp_elt_opcode (BINOP_LOGICAL_OR); }
420 exp : exp XOR exp /* Fix for Ada elementwise XOR */
421 { write_exp_elt_opcode (BINOP_BITWISE_XOR); }
424 simple_exp : simple_exp TICK_ACCESS
425 { write_exp_elt_opcode (UNOP_ADDR); }
426 | simple_exp TICK_ADDRESS
427 { write_exp_elt_opcode (UNOP_ADDR);
428 write_exp_elt_opcode (UNOP_CAST);
429 write_exp_elt_type (builtin_type_ada_system_address);
430 write_exp_elt_opcode (UNOP_CAST);
432 | simple_exp TICK_FIRST tick_arglist
433 { write_int ($3, builtin_type_int);
434 write_exp_elt_opcode (OP_ATR_FIRST); }
435 | simple_exp TICK_LAST tick_arglist
436 { write_int ($3, builtin_type_int);
437 write_exp_elt_opcode (OP_ATR_LAST); }
438 | simple_exp TICK_LENGTH tick_arglist
439 { write_int ($3, builtin_type_int);
440 write_exp_elt_opcode (OP_ATR_LENGTH); }
441 | simple_exp TICK_SIZE
442 { write_exp_elt_opcode (OP_ATR_SIZE); }
443 | simple_exp TICK_TAG
444 { write_exp_elt_opcode (OP_ATR_TAG); }
445 | opt_type_prefix TICK_MIN '(' exp ',' exp ')'
446 { write_exp_elt_opcode (OP_ATR_MIN); }
447 | opt_type_prefix TICK_MAX '(' exp ',' exp ')'
448 { write_exp_elt_opcode (OP_ATR_MAX); }
449 | opt_type_prefix TICK_POS '(' exp ')'
450 { write_exp_elt_opcode (OP_ATR_POS); }
451 | type_prefix TICK_FIRST tick_arglist
452 { write_int ($3, builtin_type_int);
453 write_exp_elt_opcode (OP_ATR_FIRST); }
454 | type_prefix TICK_LAST tick_arglist
455 { write_int ($3, builtin_type_int);
456 write_exp_elt_opcode (OP_ATR_LAST); }
457 | type_prefix TICK_LENGTH tick_arglist
458 { write_int ($3, builtin_type_int);
459 write_exp_elt_opcode (OP_ATR_LENGTH); }
460 | type_prefix TICK_VAL '(' exp ')'
461 { write_exp_elt_opcode (OP_ATR_VAL); }
462 | type_prefix TICK_MODULUS
463 { write_exp_elt_opcode (OP_ATR_MODULUS); }
466 tick_arglist : %prec '('
474 { write_exp_elt_opcode (OP_TYPE);
475 write_exp_elt_type ($1);
476 write_exp_elt_opcode (OP_TYPE); }
482 { write_exp_elt_opcode (OP_TYPE);
483 write_exp_elt_type (builtin_type_void);
484 write_exp_elt_opcode (OP_TYPE); }
489 { write_int ((LONGEST) $1.val, $1.type); }
493 { write_int (convert_char_literal (type_qualifier, $1.val),
494 (type_qualifier == NULL)
495 ? $1.type : type_qualifier);
500 { write_exp_elt_opcode (OP_DOUBLE);
501 write_exp_elt_type ($1.type);
502 write_exp_elt_dblcst ($1.dval);
503 write_exp_elt_opcode (OP_DOUBLE);
508 { write_int (0, builtin_type_int); }
513 write_exp_elt_opcode (OP_STRING);
514 write_exp_string ($1);
515 write_exp_elt_opcode (OP_STRING);
520 { error ("NEW not implemented."); }
523 variable: NAME { write_var_from_name (NULL, $1); }
524 | block NAME /* GDB extension */
525 { write_var_from_name ($1, $2); }
527 { write_object_renaming (NULL, $1.sym,
528 MAX_RENAMING_CHAIN_LENGTH); }
529 | block OBJECT_RENAMING
530 { write_object_renaming ($1, $2.sym,
531 MAX_RENAMING_CHAIN_LENGTH); }
536 | OBJECT_RENAMING { }
539 block : BLOCKNAME /* GDB extension */
541 | block BLOCKNAME /* GDB extension */
546 type : TYPENAME { $$ = $1; }
547 | block TYPENAME { $$ = $2; }
548 | TYPENAME TICK_ACCESS
549 { $$ = lookup_pointer_type ($1); }
550 | block TYPENAME TICK_ACCESS
551 { $$ = lookup_pointer_type ($2); }
554 /* Some extensions borrowed from C, for the benefit of those who find they
555 can't get used to Ada notation in GDB. */
557 exp : '*' exp %prec '.'
558 { write_exp_elt_opcode (UNOP_IND); }
560 { write_exp_elt_opcode (UNOP_ADDR); }
562 { write_exp_elt_opcode (BINOP_SUBSCRIPT); }
567 /* yylex defined in ada-lex.c: Reads one token, getting characters */
568 /* through lexptr. */
570 /* Remap normal flex interface names (yylex) as well as gratuitiously */
571 /* global symbol names, so we can have multiple flex-generated parsers */
574 /* (See note above on previous definitions for YACC.) */
576 #define yy_create_buffer ada_yy_create_buffer
577 #define yy_delete_buffer ada_yy_delete_buffer
578 #define yy_init_buffer ada_yy_init_buffer
579 #define yy_load_buffer_state ada_yy_load_buffer_state
580 #define yy_switch_to_buffer ada_yy_switch_to_buffer
581 #define yyrestart ada_yyrestart
582 #define yytext ada_yytext
583 #define yywrap ada_yywrap
585 static struct obstack temp_parse_space;
587 /* The following kludge was found necessary to prevent conflicts between */
588 /* defs.h and non-standard stdlib.h files. */
589 #define qsort __qsort__dummy
595 lexer_init (yyin); /* (Re-)initialize lexer. */
596 left_block_context = NULL;
597 type_qualifier = NULL;
598 obstack_free (&temp_parse_space, NULL);
599 obstack_init (&temp_parse_space);
601 return _ada_parse ();
607 error ("A %s in expression, near `%s'.", (msg ? msg : "error"), lexptr);
610 /* The operator name corresponding to operator symbol STRING (adds
611 quotes and maps to lower-case). Destroys the previous contents of
612 the array pointed to by STRING.ptr. Error if STRING does not match
613 a valid Ada operator. Assumes that STRING.ptr points to a
614 null-terminated string and that, if STRING is a valid operator
615 symbol, the array pointed to by STRING.ptr contains at least
616 STRING.length+3 characters. */
619 string_to_operator (struct stoken string)
623 for (i = 0; ada_opname_table[i].encoded != NULL; i += 1)
625 if (string.length == strlen (ada_opname_table[i].decoded)-2
626 && strncasecmp (string.ptr, ada_opname_table[i].decoded+1,
629 strncpy (string.ptr, ada_opname_table[i].decoded,
635 error ("Invalid operator symbol `%s'", string.ptr);
638 /* Emit expression to access an instance of SYM, in block BLOCK (if
639 * non-NULL), and with :: qualification ORIG_LEFT_CONTEXT. */
641 write_var_from_sym (struct block *orig_left_context,
645 if (orig_left_context == NULL && symbol_read_needs_frame (sym))
647 if (innermost_block == 0 ||
648 contained_in (block, innermost_block))
649 innermost_block = block;
652 write_exp_elt_opcode (OP_VAR_VALUE);
653 write_exp_elt_block (block);
654 write_exp_elt_sym (sym);
655 write_exp_elt_opcode (OP_VAR_VALUE);
658 /* Emit expression to access an instance of NAME in :: context
659 * ORIG_LEFT_CONTEXT. If no unique symbol for NAME has been found,
660 * output a dummy symbol (good to the next call of ada_parse) for NAME
661 * in the UNDEF_DOMAIN, for later resolution by ada_resolve. */
663 write_var_from_name (struct block *orig_left_context,
664 struct name_info name)
666 if (name.msym != NULL)
668 write_exp_msymbol (name.msym,
669 lookup_function_type (builtin_type_int),
672 else if (name.sym == NULL)
674 /* Multiple matches: record name and starting block for later
675 resolution by ada_resolve. */
676 char *encoded_name = ada_encode (name.stoken.ptr);
678 obstack_alloc (&temp_parse_space, sizeof (struct symbol));
679 memset (sym, 0, sizeof (struct symbol));
680 SYMBOL_DOMAIN (sym) = UNDEF_DOMAIN;
681 SYMBOL_LINKAGE_NAME (sym)
682 = obsavestring (encoded_name, strlen (encoded_name), &temp_parse_space);
683 SYMBOL_LANGUAGE (sym) = language_ada;
685 write_exp_elt_opcode (OP_VAR_VALUE);
686 write_exp_elt_block (name.block);
687 write_exp_elt_sym (sym);
688 write_exp_elt_opcode (OP_VAR_VALUE);
691 write_var_from_sym (orig_left_context, name.block, name.sym);
694 /* Write integer constant ARG of type TYPE. */
697 write_int (LONGEST arg, struct type *type)
699 write_exp_elt_opcode (OP_LONG);
700 write_exp_elt_type (type);
701 write_exp_elt_longcst (arg);
702 write_exp_elt_opcode (OP_LONG);
705 /* Emit expression corresponding to the renamed object designated by
706 * the type RENAMING, which must be the referent of an object renaming
707 * type, in the context of ORIG_LEFT_CONTEXT. MAX_DEPTH is the maximum
708 * number of cascaded renamings to allow. */
710 write_object_renaming (struct block *orig_left_context,
711 struct symbol *renaming, int max_depth)
713 const char *qualification = SYMBOL_LINKAGE_NAME (renaming);
714 const char *simple_tail;
715 const char *expr = TYPE_FIELD_NAME (SYMBOL_TYPE (renaming), 0);
719 enum { SIMPLE_INDEX, LOWER_BOUND, UPPER_BOUND } slice_state;
722 error ("Could not find renamed symbol");
724 /* if orig_left_context is null, then use the currently selected
725 block; otherwise we might fail our symbol lookup below. */
726 if (orig_left_context == NULL)
727 orig_left_context = get_selected_block (NULL);
729 for (simple_tail = qualification + strlen (qualification);
730 simple_tail != qualification; simple_tail -= 1)
732 if (*simple_tail == '.')
737 else if (strncmp (simple_tail, "__", 2) == 0)
744 suffix = strstr (expr, "___XE");
748 name = (char *) obstack_alloc (&temp_parse_space, suffix - expr + 1);
749 strncpy (name, expr, suffix-expr);
750 name[suffix-expr] = '\000';
751 sym = lookup_symbol (name, orig_left_context, VAR_DOMAIN, 0, NULL);
753 error ("Could not find renamed variable: %s", ada_decode (name));
754 if (ada_is_object_renaming (sym))
755 write_object_renaming (orig_left_context, sym, max_depth-1);
757 write_var_from_sym (orig_left_context, block_found, sym);
760 slice_state = SIMPLE_INDEX;
761 while (*suffix == 'X')
768 write_exp_elt_opcode (UNOP_IND);
771 slice_state = LOWER_BOUND;
774 if (isdigit (*suffix))
777 long val = strtol (suffix, &next, 10);
781 write_exp_elt_opcode (OP_LONG);
782 write_exp_elt_type (builtin_type_ada_int);
783 write_exp_elt_longcst ((LONGEST) val);
784 write_exp_elt_opcode (OP_LONG);
791 struct symbol *index_sym;
793 end = strchr (suffix, 'X');
795 end = suffix + strlen (suffix);
797 index_len = simple_tail - qualification + 2 + (suffix - end) + 1;
799 = (char *) obstack_alloc (&temp_parse_space, index_len);
800 memset (index_name, '\000', index_len);
801 strncpy (index_name, qualification, simple_tail - qualification);
802 index_name[simple_tail - qualification] = '\000';
803 strncat (index_name, suffix, suffix-end);
807 lookup_symbol (index_name, NULL, VAR_DOMAIN, 0, NULL);
808 if (index_sym == NULL)
809 error ("Could not find %s", index_name);
810 write_var_from_sym (NULL, block_found, sym);
812 if (slice_state == SIMPLE_INDEX)
814 write_exp_elt_opcode (OP_FUNCALL);
815 write_exp_elt_longcst ((LONGEST) 1);
816 write_exp_elt_opcode (OP_FUNCALL);
818 else if (slice_state == LOWER_BOUND)
819 slice_state = UPPER_BOUND;
820 else if (slice_state == UPPER_BOUND)
822 write_exp_elt_opcode (TERNOP_SLICE);
823 slice_state = SIMPLE_INDEX;
829 struct stoken field_name;
833 if (slice_state != SIMPLE_INDEX)
835 end = strchr (suffix, 'X');
837 end = suffix + strlen (suffix);
838 field_name.length = end - suffix;
839 field_name.ptr = (char *) malloc (end - suffix + 1);
840 strncpy (field_name.ptr, suffix, end - suffix);
841 field_name.ptr[end - suffix] = '\000';
843 write_exp_elt_opcode (STRUCTOP_STRUCT);
844 write_exp_string (field_name);
845 write_exp_elt_opcode (STRUCTOP_STRUCT);
853 if (slice_state == SIMPLE_INDEX)
857 error ("Internal error in encoding of renaming declaration: %s",
858 SYMBOL_LINKAGE_NAME (renaming));
861 /* Convert the character literal whose ASCII value would be VAL to the
862 appropriate value of type TYPE, if there is a translation.
863 Otherwise return VAL. Hence, in an enumeration type ('A', 'B'),
864 the literal 'A' (VAL == 65), returns 0. */
866 convert_char_literal (struct type *type, LONGEST val)
871 if (type == NULL || TYPE_CODE (type) != TYPE_CODE_ENUM)
873 sprintf (name, "QU%02x", (int) val);
874 for (f = 0; f < TYPE_NFIELDS (type); f += 1)
876 if (strcmp (name, TYPE_FIELD_NAME (type, f)) == 0)
877 return TYPE_FIELD_BITPOS (type, f);
883 _initialize_ada_exp (void)
885 obstack_init (&temp_parse_space);