* mi-main.c (mi_cmd_thread_select): Only return MI_CMD_CAUGHT_ERROR
[deliverable/binutils-gdb.git] / gdb / ch-lang.c
CommitLineData
db034ac5
AC
1// OBSOLETE /* Chill language support routines for GDB, the GNU debugger.
2// OBSOLETE Copyright 1992, 1993, 1994, 1995, 1996, 2000, 2001, 2002
3// OBSOLETE Free Software Foundation, Inc.
4// OBSOLETE
5// OBSOLETE This file is part of GDB.
6// OBSOLETE
7// OBSOLETE This program is free software; you can redistribute it and/or modify
8// OBSOLETE it under the terms of the GNU General Public License as published by
9// OBSOLETE the Free Software Foundation; either version 2 of the License, or
10// OBSOLETE (at your option) any later version.
11// OBSOLETE
12// OBSOLETE This program is distributed in the hope that it will be useful,
13// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of
14// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15// OBSOLETE GNU General Public License for more details.
16// OBSOLETE
17// OBSOLETE You should have received a copy of the GNU General Public License
18// OBSOLETE along with this program; if not, write to the Free Software
19// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330,
20// OBSOLETE Boston, MA 02111-1307, USA. */
21// OBSOLETE
22// OBSOLETE #include "defs.h"
23// OBSOLETE #include "symtab.h"
24// OBSOLETE #include "gdbtypes.h"
25// OBSOLETE #include "value.h"
26// OBSOLETE #include "expression.h"
27// OBSOLETE #include "parser-defs.h"
28// OBSOLETE #include "language.h"
29// OBSOLETE #include "ch-lang.h"
30// OBSOLETE #include "valprint.h"
31// OBSOLETE
32// OBSOLETE extern void _initialize_chill_language (void);
33// OBSOLETE
34// OBSOLETE static struct value *evaluate_subexp_chill (struct type *, struct expression *,
35// OBSOLETE int *, enum noside);
36// OBSOLETE
37// OBSOLETE static struct value *value_chill_max_min (enum exp_opcode, struct value *);
38// OBSOLETE
39// OBSOLETE static struct value *value_chill_card (struct value *);
40// OBSOLETE
41// OBSOLETE static struct value *value_chill_length (struct value *);
42// OBSOLETE
43// OBSOLETE static struct type *chill_create_fundamental_type (struct objfile *, int);
44// OBSOLETE
45// OBSOLETE static void chill_printstr (struct ui_file * stream, char *string,
46// OBSOLETE unsigned int length, int width,
47// OBSOLETE int force_ellipses);
48// OBSOLETE
49// OBSOLETE static void chill_printchar (int, struct ui_file *);
50// OBSOLETE
51// OBSOLETE /* For now, Chill uses a simple mangling algorithm whereby you simply
52// OBSOLETE discard everything after the occurance of two successive CPLUS_MARKER
53// OBSOLETE characters to derive the demangled form. */
54// OBSOLETE
55// OBSOLETE char *
56// OBSOLETE chill_demangle (const char *mangled)
57// OBSOLETE {
58// OBSOLETE const char *joiner = NULL;
59// OBSOLETE char *demangled;
60// OBSOLETE const char *cp = mangled;
61// OBSOLETE
62// OBSOLETE while (*cp)
63// OBSOLETE {
64// OBSOLETE if (is_cplus_marker (*cp))
65// OBSOLETE {
66// OBSOLETE joiner = cp;
67// OBSOLETE break;
68// OBSOLETE }
69// OBSOLETE cp++;
70// OBSOLETE }
71// OBSOLETE if (joiner != NULL && *(joiner + 1) == *joiner)
72// OBSOLETE {
73// OBSOLETE demangled = savestring (mangled, joiner - mangled);
74// OBSOLETE }
75// OBSOLETE else
76// OBSOLETE {
77// OBSOLETE demangled = NULL;
78// OBSOLETE }
79// OBSOLETE return (demangled);
80// OBSOLETE }
81// OBSOLETE
82// OBSOLETE static void
83// OBSOLETE chill_printchar (register int c, struct ui_file *stream)
84// OBSOLETE {
85// OBSOLETE c &= 0xFF; /* Avoid sign bit follies */
86// OBSOLETE
87// OBSOLETE if (PRINT_LITERAL_FORM (c))
88// OBSOLETE {
89// OBSOLETE if (c == '\'' || c == '^')
90// OBSOLETE fprintf_filtered (stream, "'%c%c'", c, c);
91// OBSOLETE else
92// OBSOLETE fprintf_filtered (stream, "'%c'", c);
93// OBSOLETE }
94// OBSOLETE else
95// OBSOLETE {
96// OBSOLETE fprintf_filtered (stream, "'^(%u)'", (unsigned int) c);
97// OBSOLETE }
98// OBSOLETE }
99// OBSOLETE
100// OBSOLETE /* Print the character string STRING, printing at most LENGTH characters.
101// OBSOLETE Printing stops early if the number hits print_max; repeat counts
102// OBSOLETE are printed as appropriate. Print ellipses at the end if we
103// OBSOLETE had to stop before printing LENGTH characters, or if FORCE_ELLIPSES.
104// OBSOLETE Note that gdb maintains the length of strings without counting the
105// OBSOLETE terminating null byte, while chill strings are typically written with
106// OBSOLETE an explicit null byte. So we always assume an implied null byte
107// OBSOLETE until gdb is able to maintain non-null terminated strings as well
108// OBSOLETE as null terminated strings (FIXME).
109// OBSOLETE */
110// OBSOLETE
111// OBSOLETE static void
112// OBSOLETE chill_printstr (struct ui_file *stream, char *string, unsigned int length,
113// OBSOLETE int width, int force_ellipses)
114// OBSOLETE {
115// OBSOLETE register unsigned int i;
116// OBSOLETE unsigned int things_printed = 0;
117// OBSOLETE int in_literal_form = 0;
118// OBSOLETE int in_control_form = 0;
119// OBSOLETE int need_slashslash = 0;
120// OBSOLETE unsigned int c;
121// OBSOLETE
122// OBSOLETE if (length == 0)
123// OBSOLETE {
124// OBSOLETE fputs_filtered ("\"\"", stream);
125// OBSOLETE return;
126// OBSOLETE }
127// OBSOLETE
128// OBSOLETE for (i = 0; i < length && things_printed < print_max; ++i)
129// OBSOLETE {
130// OBSOLETE /* Position of the character we are examining
131// OBSOLETE to see whether it is repeated. */
132// OBSOLETE unsigned int rep1;
133// OBSOLETE /* Number of repetitions we have detected so far. */
134// OBSOLETE unsigned int reps;
135// OBSOLETE
136// OBSOLETE QUIT;
137// OBSOLETE
138// OBSOLETE if (need_slashslash)
139// OBSOLETE {
140// OBSOLETE fputs_filtered ("//", stream);
141// OBSOLETE need_slashslash = 0;
142// OBSOLETE }
143// OBSOLETE
144// OBSOLETE rep1 = i + 1;
145// OBSOLETE reps = 1;
146// OBSOLETE while (rep1 < length && string[rep1] == string[i])
147// OBSOLETE {
148// OBSOLETE ++rep1;
149// OBSOLETE ++reps;
150// OBSOLETE }
151// OBSOLETE
152// OBSOLETE c = string[i];
153// OBSOLETE if (reps > repeat_count_threshold)
154// OBSOLETE {
155// OBSOLETE if (in_control_form || in_literal_form)
156// OBSOLETE {
157// OBSOLETE if (in_control_form)
158// OBSOLETE fputs_filtered (")", stream);
159// OBSOLETE fputs_filtered ("\"//", stream);
160// OBSOLETE in_control_form = in_literal_form = 0;
161// OBSOLETE }
162// OBSOLETE chill_printchar (c, stream);
163// OBSOLETE fprintf_filtered (stream, "<repeats %u times>", reps);
164// OBSOLETE i = rep1 - 1;
165// OBSOLETE things_printed += repeat_count_threshold;
166// OBSOLETE need_slashslash = 1;
167// OBSOLETE }
168// OBSOLETE else
169// OBSOLETE {
170// OBSOLETE if (!in_literal_form && !in_control_form)
171// OBSOLETE fputs_filtered ("\"", stream);
172// OBSOLETE if (PRINT_LITERAL_FORM (c))
173// OBSOLETE {
174// OBSOLETE if (!in_literal_form)
175// OBSOLETE {
176// OBSOLETE if (in_control_form)
177// OBSOLETE {
178// OBSOLETE fputs_filtered (")", stream);
179// OBSOLETE in_control_form = 0;
180// OBSOLETE }
181// OBSOLETE in_literal_form = 1;
182// OBSOLETE }
183// OBSOLETE fprintf_filtered (stream, "%c", c);
184// OBSOLETE if (c == '"' || c == '^')
185// OBSOLETE /* duplicate this one as must be done at input */
186// OBSOLETE fprintf_filtered (stream, "%c", c);
187// OBSOLETE }
188// OBSOLETE else
189// OBSOLETE {
190// OBSOLETE if (!in_control_form)
191// OBSOLETE {
192// OBSOLETE if (in_literal_form)
193// OBSOLETE {
194// OBSOLETE in_literal_form = 0;
195// OBSOLETE }
196// OBSOLETE fputs_filtered ("^(", stream);
197// OBSOLETE in_control_form = 1;
198// OBSOLETE }
199// OBSOLETE else
200// OBSOLETE fprintf_filtered (stream, ",");
201// OBSOLETE c = c & 0xff;
202// OBSOLETE fprintf_filtered (stream, "%u", (unsigned int) c);
203// OBSOLETE }
204// OBSOLETE ++things_printed;
205// OBSOLETE }
206// OBSOLETE }
207// OBSOLETE
208// OBSOLETE /* Terminate the quotes if necessary. */
209// OBSOLETE if (in_control_form)
210// OBSOLETE {
211// OBSOLETE fputs_filtered (")", stream);
212// OBSOLETE }
213// OBSOLETE if (in_literal_form || in_control_form)
214// OBSOLETE {
215// OBSOLETE fputs_filtered ("\"", stream);
216// OBSOLETE }
217// OBSOLETE if (force_ellipses || (i < length))
218// OBSOLETE {
219// OBSOLETE fputs_filtered ("...", stream);
220// OBSOLETE }
221// OBSOLETE }
222// OBSOLETE
223// OBSOLETE static struct type *
224// OBSOLETE chill_create_fundamental_type (struct objfile *objfile, int typeid)
225// OBSOLETE {
226// OBSOLETE register struct type *type = NULL;
227// OBSOLETE
228// OBSOLETE switch (typeid)
229// OBSOLETE {
230// OBSOLETE default:
231// OBSOLETE /* FIXME: For now, if we are asked to produce a type not in this
232// OBSOLETE language, create the equivalent of a C integer type with the
233// OBSOLETE name "<?type?>". When all the dust settles from the type
234// OBSOLETE reconstruction work, this should probably become an error. */
235// OBSOLETE type = init_type (TYPE_CODE_INT, 2, 0, "<?type?>", objfile);
236// OBSOLETE warning ("internal error: no chill fundamental type %d", typeid);
237// OBSOLETE break;
238// OBSOLETE case FT_VOID:
239// OBSOLETE /* FIXME: Currently the GNU Chill compiler emits some DWARF entries for
240// OBSOLETE typedefs, unrelated to anything directly in the code being compiled,
241// OBSOLETE that have some FT_VOID types. Just fake it for now. */
242// OBSOLETE type = init_type (TYPE_CODE_VOID, 0, 0, "<?VOID?>", objfile);
243// OBSOLETE break;
244// OBSOLETE case FT_BOOLEAN:
245// OBSOLETE type = init_type (TYPE_CODE_BOOL, 1, TYPE_FLAG_UNSIGNED, "BOOL", objfile);
246// OBSOLETE break;
247// OBSOLETE case FT_CHAR:
248// OBSOLETE type = init_type (TYPE_CODE_CHAR, 1, TYPE_FLAG_UNSIGNED, "CHAR", objfile);
249// OBSOLETE break;
250// OBSOLETE case FT_SIGNED_CHAR:
251// OBSOLETE type = init_type (TYPE_CODE_INT, 1, 0, "BYTE", objfile);
252// OBSOLETE break;
253// OBSOLETE case FT_UNSIGNED_CHAR:
254// OBSOLETE type = init_type (TYPE_CODE_INT, 1, TYPE_FLAG_UNSIGNED, "UBYTE", objfile);
255// OBSOLETE break;
256// OBSOLETE case FT_SHORT: /* Chill ints are 2 bytes */
257// OBSOLETE type = init_type (TYPE_CODE_INT, 2, 0, "INT", objfile);
258// OBSOLETE break;
259// OBSOLETE case FT_UNSIGNED_SHORT: /* Chill ints are 2 bytes */
260// OBSOLETE type = init_type (TYPE_CODE_INT, 2, TYPE_FLAG_UNSIGNED, "UINT", objfile);
261// OBSOLETE break;
262// OBSOLETE case FT_INTEGER: /* FIXME? */
263// OBSOLETE case FT_SIGNED_INTEGER: /* FIXME? */
264// OBSOLETE case FT_LONG: /* Chill longs are 4 bytes */
265// OBSOLETE case FT_SIGNED_LONG: /* Chill longs are 4 bytes */
266// OBSOLETE type = init_type (TYPE_CODE_INT, 4, 0, "LONG", objfile);
267// OBSOLETE break;
268// OBSOLETE case FT_UNSIGNED_INTEGER: /* FIXME? */
269// OBSOLETE case FT_UNSIGNED_LONG: /* Chill longs are 4 bytes */
270// OBSOLETE type = init_type (TYPE_CODE_INT, 4, TYPE_FLAG_UNSIGNED, "ULONG", objfile);
271// OBSOLETE break;
272// OBSOLETE case FT_FLOAT:
273// OBSOLETE type = init_type (TYPE_CODE_FLT, 4, 0, "REAL", objfile);
274// OBSOLETE break;
275// OBSOLETE case FT_DBL_PREC_FLOAT:
276// OBSOLETE type = init_type (TYPE_CODE_FLT, 8, 0, "LONG_REAL", objfile);
277// OBSOLETE break;
278// OBSOLETE }
279// OBSOLETE return (type);
280// OBSOLETE }
281// OBSOLETE \f
282// OBSOLETE
283// OBSOLETE /* Table of operators and their precedences for printing expressions. */
284// OBSOLETE
285// OBSOLETE static const struct op_print chill_op_print_tab[] =
286// OBSOLETE {
287// OBSOLETE {"AND", BINOP_LOGICAL_AND, PREC_LOGICAL_AND, 0},
288// OBSOLETE {"OR", BINOP_LOGICAL_OR, PREC_LOGICAL_OR, 0},
289// OBSOLETE {"NOT", UNOP_LOGICAL_NOT, PREC_PREFIX, 0},
290// OBSOLETE {"MOD", BINOP_MOD, PREC_MUL, 0},
291// OBSOLETE {"REM", BINOP_REM, PREC_MUL, 0},
292// OBSOLETE {"SIZE", UNOP_SIZEOF, PREC_BUILTIN_FUNCTION, 0},
293// OBSOLETE {"LOWER", UNOP_LOWER, PREC_BUILTIN_FUNCTION, 0},
294// OBSOLETE {"UPPER", UNOP_UPPER, PREC_BUILTIN_FUNCTION, 0},
295// OBSOLETE {"CARD", UNOP_CARD, PREC_BUILTIN_FUNCTION, 0},
296// OBSOLETE {"MAX", UNOP_CHMAX, PREC_BUILTIN_FUNCTION, 0},
297// OBSOLETE {"MIN", UNOP_CHMIN, PREC_BUILTIN_FUNCTION, 0},
298// OBSOLETE {":=", BINOP_ASSIGN, PREC_ASSIGN, 1},
299// OBSOLETE {"=", BINOP_EQUAL, PREC_EQUAL, 0},
300// OBSOLETE {"/=", BINOP_NOTEQUAL, PREC_EQUAL, 0},
301// OBSOLETE {"<=", BINOP_LEQ, PREC_ORDER, 0},
302// OBSOLETE {">=", BINOP_GEQ, PREC_ORDER, 0},
303// OBSOLETE {">", BINOP_GTR, PREC_ORDER, 0},
304// OBSOLETE {"<", BINOP_LESS, PREC_ORDER, 0},
305// OBSOLETE {"+", BINOP_ADD, PREC_ADD, 0},
306// OBSOLETE {"-", BINOP_SUB, PREC_ADD, 0},
307// OBSOLETE {"*", BINOP_MUL, PREC_MUL, 0},
308// OBSOLETE {"/", BINOP_DIV, PREC_MUL, 0},
309// OBSOLETE {"//", BINOP_CONCAT, PREC_PREFIX, 0}, /* FIXME: precedence? */
310// OBSOLETE {"-", UNOP_NEG, PREC_PREFIX, 0},
311// OBSOLETE {"->", UNOP_IND, PREC_SUFFIX, 1},
312// OBSOLETE {"->", UNOP_ADDR, PREC_PREFIX, 0},
313// OBSOLETE {":", BINOP_RANGE, PREC_ASSIGN, 0},
314// OBSOLETE {NULL, 0, 0, 0}
315// OBSOLETE };
316// OBSOLETE \f
317// OBSOLETE /* The built-in types of Chill. */
318// OBSOLETE
319// OBSOLETE struct type *builtin_type_chill_bool;
320// OBSOLETE struct type *builtin_type_chill_char;
321// OBSOLETE struct type *builtin_type_chill_long;
322// OBSOLETE struct type *builtin_type_chill_ulong;
323// OBSOLETE struct type *builtin_type_chill_real;
324// OBSOLETE
325// OBSOLETE struct type **const (chill_builtin_types[]) =
326// OBSOLETE {
327// OBSOLETE &builtin_type_chill_bool,
328// OBSOLETE &builtin_type_chill_char,
329// OBSOLETE &builtin_type_chill_long,
330// OBSOLETE &builtin_type_chill_ulong,
331// OBSOLETE &builtin_type_chill_real,
332// OBSOLETE 0
333// OBSOLETE };
334// OBSOLETE
335// OBSOLETE /* Calculate LOWER or UPPER of TYPE.
336// OBSOLETE Returns the result as an integer.
337// OBSOLETE *RESULT_TYPE is the appropriate type for the result. */
338// OBSOLETE
339// OBSOLETE LONGEST
340// OBSOLETE type_lower_upper (enum exp_opcode op, /* Either UNOP_LOWER or UNOP_UPPER */
341// OBSOLETE struct type *type, struct type **result_type)
342// OBSOLETE {
343// OBSOLETE LONGEST low, high;
344// OBSOLETE *result_type = type;
345// OBSOLETE CHECK_TYPEDEF (type);
346// OBSOLETE switch (TYPE_CODE (type))
347// OBSOLETE {
348// OBSOLETE case TYPE_CODE_STRUCT:
349// OBSOLETE *result_type = builtin_type_int;
350// OBSOLETE if (chill_varying_type (type))
351// OBSOLETE return type_lower_upper (op, TYPE_FIELD_TYPE (type, 1), result_type);
352// OBSOLETE break;
353// OBSOLETE case TYPE_CODE_ARRAY:
354// OBSOLETE case TYPE_CODE_BITSTRING:
355// OBSOLETE case TYPE_CODE_STRING:
356// OBSOLETE type = TYPE_FIELD_TYPE (type, 0); /* Get index type */
357// OBSOLETE
358// OBSOLETE /* ... fall through ... */
359// OBSOLETE case TYPE_CODE_RANGE:
360// OBSOLETE *result_type = TYPE_TARGET_TYPE (type);
361// OBSOLETE return op == UNOP_LOWER ? TYPE_LOW_BOUND (type) : TYPE_HIGH_BOUND (type);
362// OBSOLETE
363// OBSOLETE case TYPE_CODE_ENUM:
364// OBSOLETE case TYPE_CODE_BOOL:
365// OBSOLETE case TYPE_CODE_INT:
366// OBSOLETE case TYPE_CODE_CHAR:
367// OBSOLETE if (get_discrete_bounds (type, &low, &high) >= 0)
368// OBSOLETE {
369// OBSOLETE *result_type = type;
370// OBSOLETE return op == UNOP_LOWER ? low : high;
371// OBSOLETE }
372// OBSOLETE break;
373// OBSOLETE case TYPE_CODE_UNDEF:
374// OBSOLETE case TYPE_CODE_PTR:
375// OBSOLETE case TYPE_CODE_UNION:
376// OBSOLETE case TYPE_CODE_FUNC:
377// OBSOLETE case TYPE_CODE_FLT:
378// OBSOLETE case TYPE_CODE_VOID:
379// OBSOLETE case TYPE_CODE_SET:
380// OBSOLETE case TYPE_CODE_ERROR:
381// OBSOLETE case TYPE_CODE_MEMBER:
382// OBSOLETE case TYPE_CODE_METHOD:
383// OBSOLETE case TYPE_CODE_REF:
384// OBSOLETE case TYPE_CODE_COMPLEX:
385// OBSOLETE default:
386// OBSOLETE break;
387// OBSOLETE }
388// OBSOLETE error ("unknown mode for LOWER/UPPER builtin");
389// OBSOLETE }
390// OBSOLETE
391// OBSOLETE static struct value *
392// OBSOLETE value_chill_length (struct value *val)
393// OBSOLETE {
394// OBSOLETE LONGEST tmp;
395// OBSOLETE struct type *type = VALUE_TYPE (val);
396// OBSOLETE struct type *ttype;
397// OBSOLETE CHECK_TYPEDEF (type);
398// OBSOLETE switch (TYPE_CODE (type))
399// OBSOLETE {
400// OBSOLETE case TYPE_CODE_ARRAY:
401// OBSOLETE case TYPE_CODE_BITSTRING:
402// OBSOLETE case TYPE_CODE_STRING:
403// OBSOLETE tmp = type_lower_upper (UNOP_UPPER, type, &ttype)
404// OBSOLETE - type_lower_upper (UNOP_LOWER, type, &ttype) + 1;
405// OBSOLETE break;
406// OBSOLETE case TYPE_CODE_STRUCT:
407// OBSOLETE if (chill_varying_type (type))
408// OBSOLETE {
409// OBSOLETE tmp = unpack_long (TYPE_FIELD_TYPE (type, 0), VALUE_CONTENTS (val));
410// OBSOLETE break;
411// OBSOLETE }
412// OBSOLETE /* ... else fall through ... */
413// OBSOLETE default:
414// OBSOLETE error ("bad argument to LENGTH builtin");
415// OBSOLETE }
416// OBSOLETE return value_from_longest (builtin_type_int, tmp);
417// OBSOLETE }
418// OBSOLETE
419// OBSOLETE static struct value *
420// OBSOLETE value_chill_card (struct value *val)
421// OBSOLETE {
422// OBSOLETE LONGEST tmp = 0;
423// OBSOLETE struct type *type = VALUE_TYPE (val);
424// OBSOLETE CHECK_TYPEDEF (type);
425// OBSOLETE
426// OBSOLETE if (TYPE_CODE (type) == TYPE_CODE_SET)
427// OBSOLETE {
428// OBSOLETE struct type *range_type = TYPE_INDEX_TYPE (type);
429// OBSOLETE LONGEST lower_bound, upper_bound;
430// OBSOLETE int i;
431// OBSOLETE
432// OBSOLETE get_discrete_bounds (range_type, &lower_bound, &upper_bound);
433// OBSOLETE for (i = lower_bound; i <= upper_bound; i++)
434// OBSOLETE if (value_bit_index (type, VALUE_CONTENTS (val), i) > 0)
435// OBSOLETE tmp++;
436// OBSOLETE }
437// OBSOLETE else
438// OBSOLETE error ("bad argument to CARD builtin");
439// OBSOLETE
440// OBSOLETE return value_from_longest (builtin_type_int, tmp);
441// OBSOLETE }
442// OBSOLETE
443// OBSOLETE static struct value *
444// OBSOLETE value_chill_max_min (enum exp_opcode op, struct value *val)
445// OBSOLETE {
446// OBSOLETE LONGEST tmp = 0;
447// OBSOLETE struct type *type = VALUE_TYPE (val);
448// OBSOLETE struct type *elttype;
449// OBSOLETE CHECK_TYPEDEF (type);
450// OBSOLETE
451// OBSOLETE if (TYPE_CODE (type) == TYPE_CODE_SET)
452// OBSOLETE {
453// OBSOLETE LONGEST lower_bound, upper_bound;
454// OBSOLETE int i, empty = 1;
455// OBSOLETE
456// OBSOLETE elttype = TYPE_INDEX_TYPE (type);
457// OBSOLETE CHECK_TYPEDEF (elttype);
458// OBSOLETE get_discrete_bounds (elttype, &lower_bound, &upper_bound);
459// OBSOLETE
460// OBSOLETE if (op == UNOP_CHMAX)
461// OBSOLETE {
462// OBSOLETE for (i = upper_bound; i >= lower_bound; i--)
463// OBSOLETE {
464// OBSOLETE if (value_bit_index (type, VALUE_CONTENTS (val), i) > 0)
465// OBSOLETE {
466// OBSOLETE tmp = i;
467// OBSOLETE empty = 0;
468// OBSOLETE break;
469// OBSOLETE }
470// OBSOLETE }
471// OBSOLETE }
472// OBSOLETE else
473// OBSOLETE {
474// OBSOLETE for (i = lower_bound; i <= upper_bound; i++)
475// OBSOLETE {
476// OBSOLETE if (value_bit_index (type, VALUE_CONTENTS (val), i) > 0)
477// OBSOLETE {
478// OBSOLETE tmp = i;
479// OBSOLETE empty = 0;
480// OBSOLETE break;
481// OBSOLETE }
482// OBSOLETE }
483// OBSOLETE }
484// OBSOLETE if (empty)
485// OBSOLETE error ("%s for empty powerset", op == UNOP_CHMAX ? "MAX" : "MIN");
486// OBSOLETE }
487// OBSOLETE else
488// OBSOLETE error ("bad argument to %s builtin", op == UNOP_CHMAX ? "MAX" : "MIN");
489// OBSOLETE
490// OBSOLETE return value_from_longest (TYPE_CODE (elttype) == TYPE_CODE_RANGE
491// OBSOLETE ? TYPE_TARGET_TYPE (elttype)
492// OBSOLETE : elttype,
493// OBSOLETE tmp);
494// OBSOLETE }
495// OBSOLETE
496// OBSOLETE static struct value *
497// OBSOLETE evaluate_subexp_chill (struct type *expect_type,
498// OBSOLETE register struct expression *exp, register int *pos,
499// OBSOLETE enum noside noside)
500// OBSOLETE {
501// OBSOLETE int pc = *pos;
502// OBSOLETE struct type *type;
503// OBSOLETE int tem, nargs;
504// OBSOLETE struct value *arg1;
505// OBSOLETE struct value **argvec;
506// OBSOLETE enum exp_opcode op = exp->elts[*pos].opcode;
507// OBSOLETE switch (op)
508// OBSOLETE {
509// OBSOLETE case MULTI_SUBSCRIPT:
510// OBSOLETE if (noside == EVAL_SKIP)
511// OBSOLETE break;
512// OBSOLETE (*pos) += 3;
513// OBSOLETE nargs = longest_to_int (exp->elts[pc + 1].longconst);
514// OBSOLETE arg1 = evaluate_subexp_with_coercion (exp, pos, noside);
515// OBSOLETE type = check_typedef (VALUE_TYPE (arg1));
516// OBSOLETE
517// OBSOLETE if (nargs == 1 && TYPE_CODE (type) == TYPE_CODE_INT)
518// OBSOLETE {
519// OBSOLETE /* Looks like string repetition. */
520// OBSOLETE struct value *string = evaluate_subexp_with_coercion (exp, pos,
521// OBSOLETE noside);
522// OBSOLETE return value_concat (arg1, string);
523// OBSOLETE }
524// OBSOLETE
525// OBSOLETE switch (TYPE_CODE (type))
526// OBSOLETE {
527// OBSOLETE case TYPE_CODE_PTR:
528// OBSOLETE type = check_typedef (TYPE_TARGET_TYPE (type));
529// OBSOLETE if (!type || TYPE_CODE (type) != TYPE_CODE_FUNC)
530// OBSOLETE error ("reference value used as function");
531// OBSOLETE /* ... fall through ... */
532// OBSOLETE case TYPE_CODE_FUNC:
533// OBSOLETE /* It's a function call. */
534// OBSOLETE if (noside == EVAL_AVOID_SIDE_EFFECTS)
535// OBSOLETE break;
536// OBSOLETE
537// OBSOLETE /* Allocate arg vector, including space for the function to be
538// OBSOLETE called in argvec[0] and a terminating NULL */
539// OBSOLETE argvec = (struct value **) alloca (sizeof (struct value *)
540// OBSOLETE * (nargs + 2));
541// OBSOLETE argvec[0] = arg1;
542// OBSOLETE tem = 1;
543// OBSOLETE for (; tem <= nargs && tem <= TYPE_NFIELDS (type); tem++)
544// OBSOLETE {
545// OBSOLETE argvec[tem]
546// OBSOLETE = evaluate_subexp_chill (TYPE_FIELD_TYPE (type, tem - 1),
547// OBSOLETE exp, pos, noside);
548// OBSOLETE }
549// OBSOLETE for (; tem <= nargs; tem++)
550// OBSOLETE argvec[tem] = evaluate_subexp_with_coercion (exp, pos, noside);
551// OBSOLETE argvec[tem] = 0; /* signal end of arglist */
552// OBSOLETE
553// OBSOLETE return call_function_by_hand (argvec[0], nargs, argvec + 1);
554// OBSOLETE default:
555// OBSOLETE break;
556// OBSOLETE }
557// OBSOLETE
558// OBSOLETE while (nargs-- > 0)
559// OBSOLETE {
560// OBSOLETE struct value *index = evaluate_subexp_with_coercion (exp, pos,
561// OBSOLETE noside);
562// OBSOLETE arg1 = value_subscript (arg1, index);
563// OBSOLETE }
564// OBSOLETE return (arg1);
565// OBSOLETE
566// OBSOLETE case UNOP_LOWER:
567// OBSOLETE case UNOP_UPPER:
568// OBSOLETE (*pos)++;
569// OBSOLETE if (noside == EVAL_SKIP)
570// OBSOLETE {
571// OBSOLETE (*exp->language_defn->evaluate_exp) (NULL_TYPE, exp, pos, EVAL_SKIP);
572// OBSOLETE goto nosideret;
573// OBSOLETE }
574// OBSOLETE arg1 = (*exp->language_defn->evaluate_exp) (NULL_TYPE, exp, pos,
575// OBSOLETE EVAL_AVOID_SIDE_EFFECTS);
576// OBSOLETE tem = type_lower_upper (op, VALUE_TYPE (arg1), &type);
577// OBSOLETE return value_from_longest (type, tem);
578// OBSOLETE
579// OBSOLETE case UNOP_LENGTH:
580// OBSOLETE (*pos)++;
581// OBSOLETE arg1 = (*exp->language_defn->evaluate_exp) (NULL_TYPE, exp, pos, noside);
582// OBSOLETE return value_chill_length (arg1);
583// OBSOLETE
584// OBSOLETE case UNOP_CARD:
585// OBSOLETE (*pos)++;
586// OBSOLETE arg1 = (*exp->language_defn->evaluate_exp) (NULL_TYPE, exp, pos, noside);
587// OBSOLETE return value_chill_card (arg1);
588// OBSOLETE
589// OBSOLETE case UNOP_CHMAX:
590// OBSOLETE case UNOP_CHMIN:
591// OBSOLETE (*pos)++;
592// OBSOLETE arg1 = (*exp->language_defn->evaluate_exp) (NULL_TYPE, exp, pos, noside);
593// OBSOLETE return value_chill_max_min (op, arg1);
594// OBSOLETE
595// OBSOLETE case BINOP_COMMA:
596// OBSOLETE error ("',' operator used in invalid context");
597// OBSOLETE
598// OBSOLETE default:
599// OBSOLETE break;
600// OBSOLETE }
601// OBSOLETE
602// OBSOLETE return evaluate_subexp_standard (expect_type, exp, pos, noside);
603// OBSOLETE nosideret:
604// OBSOLETE return value_from_longest (builtin_type_long, (LONGEST) 1);
605// OBSOLETE }
606// OBSOLETE
607// OBSOLETE const struct language_defn chill_language_defn =
608// OBSOLETE {
609// OBSOLETE "chill",
610// OBSOLETE language_chill,
611// OBSOLETE chill_builtin_types,
612// OBSOLETE range_check_on,
613// OBSOLETE type_check_on,
614// OBSOLETE case_sensitive_on,
615// OBSOLETE chill_parse, /* parser */
616// OBSOLETE chill_error, /* parser error function */
617// OBSOLETE evaluate_subexp_chill,
618// OBSOLETE chill_printchar, /* print a character constant */
619// OBSOLETE chill_printstr, /* function to print a string constant */
620// OBSOLETE NULL, /* Function to print a single char */
621// OBSOLETE chill_create_fundamental_type, /* Create fundamental type in this language */
622// OBSOLETE chill_print_type, /* Print a type using appropriate syntax */
623// OBSOLETE chill_val_print, /* Print a value using appropriate syntax */
624// OBSOLETE chill_value_print, /* Print a top-levl value */
625// OBSOLETE {"", "B'", "", ""}, /* Binary format info */
626// OBSOLETE {"O'%lo", "O'", "o", ""}, /* Octal format info */
627// OBSOLETE {"D'%ld", "D'", "d", ""}, /* Decimal format info */
628// OBSOLETE {"H'%lx", "H'", "x", ""}, /* Hex format info */
629// OBSOLETE chill_op_print_tab, /* expression operators for printing */
630// OBSOLETE 0, /* arrays are first-class (not c-style) */
631// OBSOLETE 0, /* String lower bound */
632// OBSOLETE &builtin_type_chill_char, /* Type of string elements */
633// OBSOLETE LANG_MAGIC
634// OBSOLETE };
635// OBSOLETE
636// OBSOLETE /* Initialization for Chill */
637// OBSOLETE
638// OBSOLETE void
639// OBSOLETE _initialize_chill_language (void)
640// OBSOLETE {
641// OBSOLETE builtin_type_chill_bool =
642// OBSOLETE init_type (TYPE_CODE_BOOL, TARGET_CHAR_BIT / TARGET_CHAR_BIT,
643// OBSOLETE TYPE_FLAG_UNSIGNED,
644// OBSOLETE "BOOL", (struct objfile *) NULL);
645// OBSOLETE builtin_type_chill_char =
646// OBSOLETE init_type (TYPE_CODE_CHAR, TARGET_CHAR_BIT / TARGET_CHAR_BIT,
647// OBSOLETE TYPE_FLAG_UNSIGNED,
648// OBSOLETE "CHAR", (struct objfile *) NULL);
649// OBSOLETE builtin_type_chill_long =
650// OBSOLETE init_type (TYPE_CODE_INT, TARGET_LONG_BIT / TARGET_CHAR_BIT,
651// OBSOLETE 0,
652// OBSOLETE "LONG", (struct objfile *) NULL);
653// OBSOLETE builtin_type_chill_ulong =
654// OBSOLETE init_type (TYPE_CODE_INT, TARGET_LONG_BIT / TARGET_CHAR_BIT,
655// OBSOLETE TYPE_FLAG_UNSIGNED,
656// OBSOLETE "ULONG", (struct objfile *) NULL);
657// OBSOLETE builtin_type_chill_real =
658// OBSOLETE init_type (TYPE_CODE_FLT, TARGET_DOUBLE_BIT / TARGET_CHAR_BIT,
659// OBSOLETE 0,
660// OBSOLETE "LONG_REAL", (struct objfile *) NULL);
661// OBSOLETE
662// OBSOLETE add_language (&chill_language_defn);
663// OBSOLETE }
This page took 0.113696 seconds and 4 git commands to generate.