Thu Nov 30 23:54:17 1995 Per Bothner <bothner@kalessin.cygnus.com>
+ * language.c (lang_bool_type), language.h: New function.
+ * language.h (LA_BOOL_TYPE): New macro.
+ * eval.c (evaluate_subexp_standard) Use LA_BOOL_TYPE instead
+ of builtin_type_int where appropriate,
+ * valarith.c (value_subscript): Likewise.
+
* valops.c (value_slice): Implement (value) bitstring slices.
* valprint.c (val_print): If TYPE_LENGTH is zero, don't automatically
print "<incomplete type>" - Chill has zero-length (string) types.
tem = value_logical_not (arg1);
arg2 = evaluate_subexp (NULL_TYPE, exp, pos,
(tem ? EVAL_SKIP : noside));
- return value_from_longest (builtin_type_int,
+ return value_from_longest (LA_BOOL_TYPE,
(LONGEST) (!tem && !value_logical_not (arg2)));
}
tem = value_logical_not (arg1);
arg2 = evaluate_subexp (NULL_TYPE, exp, pos,
(!tem ? EVAL_SKIP : noside));
- return value_from_longest (builtin_type_int,
+ return value_from_longest (LA_BOOL_TYPE,
(LONGEST) (!tem || !value_logical_not (arg2)));
}
else
{
tem = value_equal (arg1, arg2);
- return value_from_longest (builtin_type_int, (LONGEST) tem);
+ return value_from_longest (LA_BOOL_TYPE, (LONGEST) tem);
}
case BINOP_NOTEQUAL:
else
{
tem = value_equal (arg1, arg2);
- return value_from_longest (builtin_type_int, (LONGEST) ! tem);
+ return value_from_longest (LA_BOOL_TYPE, (LONGEST) ! tem);
}
case BINOP_LESS:
else
{
tem = value_less (arg1, arg2);
- return value_from_longest (builtin_type_int, (LONGEST) tem);
+ return value_from_longest (LA_BOOL_TYPE, (LONGEST) tem);
}
case BINOP_GTR:
else
{
tem = value_less (arg2, arg1);
- return value_from_longest (builtin_type_int, (LONGEST) tem);
+ return value_from_longest (LA_BOOL_TYPE, (LONGEST) tem);
}
case BINOP_GEQ:
else
{
tem = value_less (arg2, arg1) || value_equal (arg1, arg2);
- return value_from_longest (builtin_type_int, (LONGEST) tem);
+ return value_from_longest (LA_BOOL_TYPE, (LONGEST) tem);
}
case BINOP_LEQ:
else
{
tem = value_less (arg1, arg2) || value_equal (arg1, arg2);
- return value_from_longest (builtin_type_int, (LONGEST) tem);
+ return value_from_longest (LA_BOOL_TYPE, (LONGEST) tem);
}
case BINOP_REPEAT:
}
#endif
\f
+struct type *
+lang_bool_type ()
+{
+ struct symbol *sym;
+ struct type *type;
+ switch(current_language->la_language)
+ {
+ case language_chill:
+ return builtin_type_chill_bool;
+ case language_cplus:
+ sym = lookup_symbol ("bool", NULL, VAR_NAMESPACE, NULL, NULL);
+ if (sym)
+ {
+ struct type *type = SYMBOL_TYPE (sym);
+ if (type && TYPE_CODE (type) == TYPE_CODE_BOOL)
+ return type;
+ }
+ /* ... else fall through ... */
+ default:
+ return builtin_type_int;
+ }
+}
+\f
/* This page contains functions that return info about
(struct value) values used in GDB. */