From e58de8a23021ce9bbdee715ac79745ebb93437a8 Mon Sep 17 00:00:00 2001 From: Fred Fish Date: Sun, 15 Nov 1992 17:28:02 +0000 Subject: * Makefile.in (SFILES_MAINDIR): Add ch-exp.y. * Makefile.in (YYFILES): Add ch-exp.tab.c. * Makefile.in (YYOBJ): Add ch-exp.tab.o. * Makefile.in (saber_gdb): Add unload of ch-exp.y and load of ch-exp.tab.c. * Makefile.in (distclean): Add target ch-exp.tab.c. * Makefile.in (realclean): Add rm of ch-exp.tab.c. * Makefile.in (c-exp.tab.c, m2-exp.tab.c): Add dependency on Makefile since it contains sed patterns used in generation. Add sed pattern to also delete #include of any malloc.h. * Makefile.in (ch-exp.tab.o, ch-exp.tab.c): New targets. * ch-exp.y: New expression parser, for GNU-Chill. * c-exp.y, expr.c, expression.h, language.c, m2-exp.y, parser-defs.h, valarith.c, valops.c, value.h: Remap macros and function names to conform to K&R terminology with respect to logical and bitwise operators: UNOP_ZEROP => UNOP_LOGICAL_NOT UNOP_LOGNOT => UNOP_COMPLEMENT BINOP_LOGAND => BINOP_BITWISE_AND BINOP_LOGXOR => BINOP_BITWISE_XOR BINOP_LOGIOR => BINOP_BITWISE_IOR BINOP_AND => BINOP_LOGICAL_AND BINOP_OR => BINOP_LOGICAL_OR PREC_OR => PREC_LOGICAL_OR PREC_AND => PREC_LOGICAL_AND PREC_LOGIOR => PREC_BITWISE_IOR PREC_LOGXOR => PREC_BITWISE_XOR PREC_LOGAND => PREC_BITWISE_AND value_zerop() => value_logical_not() value_lognot() => value_complement() * c-exp.y (c_op_print_tab): Add explicit empty terminator. * m2-exp.y (m2_op_print_tab): Add explicit empty terminator. * defs.h (enum language): Add language_chill. * dwarfread.c (set_cu_language): Add LANG_CHILL case and make LANG_MODULA2 a recognized language. * eval.c (evaluate_subexp): Add OP_BOOL case. * expprint.c (print_subexp): Add OP_BOOL case. * gdbtypes.h (enum_typecode): Note TYPE_CODE_BOOL used for Chill as well as Modula-2. * gdbtypes.y (builtin_type_chill_bool, builtin_type_chill_long, builtin_type_chill_ulong, builtin_type_chill_real): Add. * i387-tdep.c (sys/dir.h): Remove, appears to be unnecessary and is nonexistant in some SVR4 based systems. * language.c (DEFAULT_ALLOCSIZE): Change from 3 => 4. * language.c (set_language_command): Add chill. * language.c (binop_result_type, integral_type, character_type, boolean_type, structured_type, value_true, binop_type_check): Add language_chill cases. * language.h (_LANG_chill): Define. * m2-exp.y (number_sign, modblock): Make static, #ifdef out unused modblock. * m2-exp.y (ANDAND): Rename to LOGICAL_AND. * source.c (source_info): Fix minor nits, print "1 line" rather than "1 lines", and "language is ". * symfile.c (deduce_language_from_filename): Recognize the filename extensions ".chill", ".c186", and ".c286" for Chill. * valarith.c (value_binop): Handle TYPE_CODE_BOOL as well as TYPE_CODE_INT and TYPE_CODE_FLOAT. * valprint.c (val_print): Print TYPE_CODE_BOOL type values as "TRUE" or "FALSE". * valprint.c (typedef_print): Add case for language_chill. * values.c (value_from_longest): Handle TYPE_CODE_BOOL. --- gdb/language.c | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) (limited to 'gdb/language.c') diff --git a/gdb/language.c b/gdb/language.c index e835445..0fb0796 100644 --- a/gdb/language.c +++ b/gdb/language.c @@ -112,7 +112,7 @@ const struct language_defn *expected_language; static const struct language_defn **languages; static unsigned languages_size; static unsigned languages_allocsize; -#define DEFAULT_ALLOCSIZE 3 +#define DEFAULT_ALLOCSIZE 4 /* The "set language/type/range" commands all put stuff in these buffers. This is to make them work as set/show commands. The @@ -165,6 +165,7 @@ set_language_command (ignore, from_tty) local or auto Automatic setting based on source file\n\ c Use the C language\n\ c++ Use the C++ language\n\ +chill Use the Chill language\n\ modula-2 Use the Modula-2 language\n"); /* Restore the silly string. */ set_language(current_language->la_language); @@ -457,6 +458,8 @@ binop_result_type(v1,v2) not needed. */ return l1 > l2 ? VALUE_TYPE(v1) : VALUE_TYPE(v2); break; + case language_chill: + error ("Missing Chill support in function binop_result_check.");/*FIXME*/ } abort(); return (struct type *)0; /* For lint */ @@ -605,6 +608,8 @@ integral_type (type) (TYPE_CODE(type) != TYPE_CODE_ENUM) ? 0 : 1; case language_m2: return TYPE_CODE(type) != TYPE_CODE_INT ? 0 : 1; + case language_chill: + error ("Missing Chill support in function integral_type."); /*FIXME*/ default: error ("Language not supported."); } @@ -640,6 +645,8 @@ character_type (type) return (TYPE_CODE(type) == TYPE_CODE_INT) && TYPE_LENGTH(type) == sizeof(char) ? 1 : 0; + case language_chill: + error ("Missing Chill support in function character_type."); /*FIXME*/ default: return (0); } @@ -652,6 +659,7 @@ boolean_type (type) { switch(current_language->la_language) { + case language_chill: case language_m2: return TYPE_CODE(type) != TYPE_CODE_BOOL ? 0 : 1; @@ -696,6 +704,8 @@ structured_type(type) return (TYPE_CODE(type) == TYPE_CODE_STRUCT) || (TYPE_CODE(type) == TYPE_CODE_SET) || (TYPE_CODE(type) == TYPE_CODE_ARRAY); + case language_chill: + error ("Missing Chill support in function structured_type."); /*FIXME*/ default: return (0); } @@ -717,7 +727,7 @@ value_true(val) case language_c: case language_cplus: - return !value_zerop (val); + return !value_logical_not (val); case language_m2: type = VALUE_TYPE(val); @@ -740,6 +750,9 @@ value_true(val) return 0; /* BOOLEAN with value FALSE */ break; + case language_chill: + error ("Missing Chill support in function value_type."); /*FIXME*/ + default: error ("Language not supported."); } @@ -786,8 +799,8 @@ binop_type_check(arg1,arg2,op) type_op_error ("Arguments to %s must be of the same type.",op); break; - case BINOP_AND: - case BINOP_OR: + case BINOP_LOGICAL_AND: + case BINOP_LOGICAL_OR: if (!boolean_type(t1) || !boolean_type(t2)) type_op_error ("Arguments to %s must be of boolean type.",op); break; @@ -839,7 +852,7 @@ binop_type_check(arg1,arg2,op) /* Unary checks -- arg2 is null */ - case UNOP_ZEROP: + case UNOP_LOGICAL_NOT: if (!boolean_type(t1)) type_op_error ("Argument to %s must be of boolean type.",op); break; @@ -900,6 +913,12 @@ binop_type_check(arg1,arg2,op) break; } #endif + +#ifdef _LANG_chill + case language_chill: + error ("Missing Chill support in function binop_type_check.");/*FIXME*/ +#endif + } } } -- cgit v1.1