From 54bbbfb43300a2ca9ef3509e9076caa1776970d1 Mon Sep 17 00:00:00 2001 From: Fred Fish Date: Sat, 2 Jan 1993 20:32:01 +0000 Subject: * eval.c (evaluate_subexp): Add case MULTI_SUBSCRIPT. * expprint.c (print_subexp): Rename BINOP_MULTI_SUBSCRIPT to MULTI_SUBSCRIPT. * expprint.c (dump_expression): New function for dumping expression vectors during gdb debugging. * expression.h (BINOP_MULTI_SUBSCRIPT): Name changed to MULTI_SUBSCRIPT and moved out of BINOP range. * expression.h (DUMP_EXPRESSION): New macro that calls dump_expression if DEBUG_EXPRESSIONS is defined. * m2-exp.y (BINOP_MULTI_SUBSCRIPT): Changed to MULTI_SUBSCRIPT. * parse.c (length_of_subexp, prefixify_subexp): Change BINOP_MULTI_SUBSCRIPT to MULTI_SUBSCRIPT. * parse.c (parse_exp_1): Call DUMP_EXPRESSION before and after prefixify'ing the expression. * printcmd.c (print_command_1): Add comment. **** start-sanitize-chill **** * ch-exp.y (expression_list): Add useful actions. * ch-exp.y (value_array_element): Add useful actions. * ch-exp.y (array_primitive_value): Add production. * ch-exp.y (yylex): Recognize ',' as a token. **** end-sanitize-chill **** --- gdb/expression.h | 45 ++++++++++++++++++++++++++++++++------------- 1 file changed, 32 insertions(+), 13 deletions(-) (limited to 'gdb/expression.h') diff --git a/gdb/expression.h b/gdb/expression.h index 0ef5c4d..8a6cf4b 100644 --- a/gdb/expression.h +++ b/gdb/expression.h @@ -20,6 +20,10 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #if !defined (EXPRESSION_H) #define EXPRESSION_H 1 +#ifdef __STDC__ +struct block; /* Forward declaration for prototypes */ +#endif + /* Definitions for saved C expressions. */ /* An expression is represented as a vector of union exp_element's. @@ -50,11 +54,11 @@ enum exp_opcode BINOP_REM, /* % */ BINOP_LSH, /* << */ BINOP_RSH, /* >> */ - BINOP_AND, /* && */ - BINOP_OR, /* || */ - BINOP_LOGAND, /* & */ - BINOP_LOGIOR, /* | */ - BINOP_LOGXOR, /* ^ */ + BINOP_LOGICAL_AND, /* && */ + BINOP_LOGICAL_OR, /* || */ + BINOP_BITWISE_AND, /* & */ + BINOP_BITWISE_IOR, /* | */ + BINOP_BITWISE_XOR, /* ^ */ BINOP_EQUAL, /* == */ BINOP_NOTEQUAL, /* != */ BINOP_LESS, /* < */ @@ -65,7 +69,6 @@ enum exp_opcode BINOP_ASSIGN, /* = */ BINOP_COMMA, /* , */ BINOP_SUBSCRIPT, /* x[y] */ - BINOP_MULTI_SUBSCRIPT, /* Modula-2 x[a,b,...] */ BINOP_EXP, /* Exponentiation */ /* C++. */ @@ -101,6 +104,14 @@ enum exp_opcode /* Operates on three values computed by following subexpressions. */ TERNOP_COND, /* ?: */ +/* Multidimensional subscript operator, such as Modula-2 x[a,b,...]. + The dimensionality is encoded in the operator, like the number of + function arguments in OP_FUNCALL, I.E. . + The value of the first following subexpression is subscripted + by each of the next following subexpressions, one per dimension. */ + + MULTI_SUBSCRIPT, + /* The OP_... series take immediate following arguments. After the arguments come another OP_... (the same one) so that the grouping can be recognized from the end. */ @@ -153,8 +164,8 @@ enum exp_opcode /* UNOP_... operate on one value from a following subexpression and replace it with a result. They take no immediate arguments. */ UNOP_NEG, /* Unary - */ - UNOP_ZEROP, /* Unary ! */ - UNOP_LOGNOT, /* Unary ~ */ + UNOP_LOGICAL_NOT, /* Unary ! */ + UNOP_COMPLEMENT, /* Unary ~ */ UNOP_IND, /* Unary * */ UNOP_ADDR, /* Unary & */ UNOP_PREINCREMENT, /* ++ before an expression */ @@ -186,11 +197,6 @@ enum exp_opcode They differ only in the error message given in case the value is not suitable or the structure component specified is not found. - After the sub-expression and before the string is a (struct type*). - This is normally NULL, but is used for the TYPE in a C++ qualified - reference like EXP.TYPE::NAME. (EXP.TYPE1::TYPE2::NAME does - not work, unfortunately.) - The length of the string follows in the next exp_element, (after the string), followed by another STRUCTOP_... code. */ STRUCTOP_STRUCT, @@ -251,4 +257,17 @@ print_expression PARAMS ((struct expression *, FILE *)); extern char * op_string PARAMS ((enum exp_opcode)); +/* To enable dumping of all parsed expressions in a human readable + form, define DEBUG_EXPRESSIONS. This is a compile time constant + at the moment, since it's not clear that this feature is important + enough to include by default. */ + +#ifdef DEBUG_EXPRESSIONS +extern void +dump_expression PARAMS ((struct expression *, FILE *, char *)); +#define DUMP_EXPRESSION(exp,file,note) dump_expression ((exp), (file), (note)) +#else +#define DUMP_EXPRESSION(exp,file,note) /* Null expansion */ +#endif /* DEBUG_EXPRESSIONS */ + #endif /* !defined (EXPRESSION_H) */ -- cgit v1.1