implied that "no side effects" was nonfunctional.
* eval.c (evaluate_subexp): Add BINOP_CONCAT case to deal with
character string and bitstring concatenation.
* expprint.c (dump_expression): Add case for BINOP_CONCAT.
* expression.h (exp_opcode): Add BINOP_CONCAT.
* gdbtypes.h (type_code): Add TYPE_CODE_BITSTRING.
* language.c (string_type): Add function to determine if a type
is a string type.
* language.c (binop_type_check): Add case for BINOP_CONCAT.
* valarith.c (value_concat): New function to concatenate two
values, such as character strings or bitstrings.
* valops.c (value_string): Remove error stub and implement
function body.
* value.h (value_concat): Add prototype.
**** start-sanitize-chill ****
* ch-exp.y (operand_3): Add actions for SLASH_SLASH (//).
* ch-exp.y (yylex): Recognize SLASH_SLASH.
* ch-lang.c (chill_op_print_tab): Add SLASH_SLASH (//) as
BINOP_CONCAT.
**** end-sanitize-chill ****
}
| operand_3 SLASH_SLASH operand_4
{
- $$ = 0; /* FIXME */
+ write_exp_elt_opcode (BINOP_CONCAT);
}
;
case '+':
case '-':
case '*':
- case '/':
case '(':
case ')':
case '[':
{"-", BINOP_SUB, PREC_ADD, 0},
{"*", BINOP_MUL, PREC_MUL, 0},
{"/", BINOP_DIV, PREC_MUL, 0},
+ {"//", BINOP_CONCAT, PREC_PREFIX, 0}, /* FIXME: precedence? */
{"-", UNOP_NEG, PREC_PREFIX, 0},
{NULL, 0, 0, 0}
};
TYPE_CODE_SET, /* Pascal sets */
TYPE_CODE_RANGE, /* Range (integers within spec'd bounds) */
TYPE_CODE_STRING, /* String types, distinct from array of char */
+ TYPE_CODE_BITSTRING, /* String of bits, distinct from bool array */
TYPE_CODE_ERROR, /* Unknown type */
/* C++ */
}
}
+/* Returns non-zero if the value is a string type */
+int
+string_type (type)
+ struct type *type;
+{
+ switch(current_language->la_language)
+ {
+ /* start-sanitize-chill */
+ case language_chill:
+ /* end-sanitize-chill */
+ case language_m2:
+ return TYPE_CODE(type) != TYPE_CODE_STRING ? 0 : 1;
+
+ case language_c:
+ case language_cplus:
+ /* C does not have distinct string type. */
+ return (0);
+ default:
+ return (0);
+ }
+}
+
/* Returns non-zero if the value is a boolean type */
int
boolean_type (type)
type_op_error ("Arguments to %s must be of the same type.",op);
break;
+ case BINOP_CONCAT:
+ if (!(string_type(t1) || character_type(t1))
+ || !(string_type(t2) || character_type(t2)))
+ type_op_error ("Arguments to %s must be strings or characters.", op);
+ break;
+
/* Unary checks -- arg2 is null */
case UNOP_LOGICAL_NOT: