15796c8dcSSimon Schubert /* Definitions for expressions stored in reversed prefix form, for GDB. 25796c8dcSSimon Schubert 3*cf7f2e2dSJohn Marino Copyright (C) 1986, 1989, 1992, 1994, 2000, 2003, 2005, 2007, 2008, 2009, 4*cf7f2e2dSJohn Marino 2010 Free Software Foundation, Inc. 55796c8dcSSimon Schubert 65796c8dcSSimon Schubert This file is part of GDB. 75796c8dcSSimon Schubert 85796c8dcSSimon Schubert This program is free software; you can redistribute it and/or modify 95796c8dcSSimon Schubert it under the terms of the GNU General Public License as published by 105796c8dcSSimon Schubert the Free Software Foundation; either version 3 of the License, or 115796c8dcSSimon Schubert (at your option) any later version. 125796c8dcSSimon Schubert 135796c8dcSSimon Schubert This program is distributed in the hope that it will be useful, 145796c8dcSSimon Schubert but WITHOUT ANY WARRANTY; without even the implied warranty of 155796c8dcSSimon Schubert MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 165796c8dcSSimon Schubert GNU General Public License for more details. 175796c8dcSSimon Schubert 185796c8dcSSimon Schubert You should have received a copy of the GNU General Public License 195796c8dcSSimon Schubert along with this program. If not, see <http://www.gnu.org/licenses/>. */ 205796c8dcSSimon Schubert 215796c8dcSSimon Schubert #if !defined (EXPRESSION_H) 225796c8dcSSimon Schubert #define EXPRESSION_H 1 235796c8dcSSimon Schubert 245796c8dcSSimon Schubert 255796c8dcSSimon Schubert #include "symtab.h" /* Needed for "struct block" type. */ 265796c8dcSSimon Schubert #include "doublest.h" /* Needed for DOUBLEST. */ 275796c8dcSSimon Schubert 285796c8dcSSimon Schubert 295796c8dcSSimon Schubert /* Definitions for saved C expressions. */ 305796c8dcSSimon Schubert 315796c8dcSSimon Schubert /* An expression is represented as a vector of union exp_element's. 325796c8dcSSimon Schubert Each exp_element is an opcode, except that some opcodes cause 335796c8dcSSimon Schubert the following exp_element to be treated as a long or double constant 345796c8dcSSimon Schubert or as a variable. The opcodes are obeyed, using a stack for temporaries. 355796c8dcSSimon Schubert The value is left on the temporary stack at the end. */ 365796c8dcSSimon Schubert 375796c8dcSSimon Schubert /* When it is necessary to include a string, 385796c8dcSSimon Schubert it can occupy as many exp_elements as it needs. 395796c8dcSSimon Schubert We find the length of the string using strlen, 405796c8dcSSimon Schubert divide to find out how many exp_elements are used up, 415796c8dcSSimon Schubert and skip that many. Strings, like numbers, are indicated 425796c8dcSSimon Schubert by the preceding opcode. */ 435796c8dcSSimon Schubert 445796c8dcSSimon Schubert enum exp_opcode 455796c8dcSSimon Schubert { 465796c8dcSSimon Schubert /* Used when it's necessary to pass an opcode which will be ignored, 475796c8dcSSimon Schubert or to catch uninitialized values. */ 485796c8dcSSimon Schubert OP_NULL, 495796c8dcSSimon Schubert 505796c8dcSSimon Schubert /* BINOP_... operate on two values computed by following subexpressions, 515796c8dcSSimon Schubert replacing them by one result value. They take no immediate arguments. */ 525796c8dcSSimon Schubert 535796c8dcSSimon Schubert BINOP_ADD, /* + */ 545796c8dcSSimon Schubert BINOP_SUB, /* - */ 555796c8dcSSimon Schubert BINOP_MUL, /* * */ 565796c8dcSSimon Schubert BINOP_DIV, /* / */ 575796c8dcSSimon Schubert BINOP_REM, /* % */ 585796c8dcSSimon Schubert BINOP_MOD, /* mod (Knuth 1.2.4) */ 595796c8dcSSimon Schubert BINOP_LSH, /* << */ 605796c8dcSSimon Schubert BINOP_RSH, /* >> */ 615796c8dcSSimon Schubert BINOP_LOGICAL_AND, /* && */ 625796c8dcSSimon Schubert BINOP_LOGICAL_OR, /* || */ 635796c8dcSSimon Schubert BINOP_BITWISE_AND, /* & */ 645796c8dcSSimon Schubert BINOP_BITWISE_IOR, /* | */ 655796c8dcSSimon Schubert BINOP_BITWISE_XOR, /* ^ */ 665796c8dcSSimon Schubert BINOP_EQUAL, /* == */ 675796c8dcSSimon Schubert BINOP_NOTEQUAL, /* != */ 685796c8dcSSimon Schubert BINOP_LESS, /* < */ 695796c8dcSSimon Schubert BINOP_GTR, /* > */ 705796c8dcSSimon Schubert BINOP_LEQ, /* <= */ 715796c8dcSSimon Schubert BINOP_GEQ, /* >= */ 725796c8dcSSimon Schubert BINOP_REPEAT, /* @ */ 735796c8dcSSimon Schubert BINOP_ASSIGN, /* = */ 745796c8dcSSimon Schubert BINOP_COMMA, /* , */ 755796c8dcSSimon Schubert BINOP_SUBSCRIPT, /* x[y] */ 765796c8dcSSimon Schubert BINOP_EXP, /* Exponentiation */ 775796c8dcSSimon Schubert 785796c8dcSSimon Schubert /* C++. */ 795796c8dcSSimon Schubert 805796c8dcSSimon Schubert BINOP_MIN, /* <? */ 815796c8dcSSimon Schubert BINOP_MAX, /* >? */ 825796c8dcSSimon Schubert 835796c8dcSSimon Schubert /* STRUCTOP_MEMBER is used for pointer-to-member constructs. 845796c8dcSSimon Schubert X . * Y translates into X STRUCTOP_MEMBER Y. */ 855796c8dcSSimon Schubert STRUCTOP_MEMBER, 865796c8dcSSimon Schubert 875796c8dcSSimon Schubert /* STRUCTOP_MPTR is used for pointer-to-member constructs 885796c8dcSSimon Schubert when X is a pointer instead of an aggregate. */ 895796c8dcSSimon Schubert STRUCTOP_MPTR, 905796c8dcSSimon Schubert 91*cf7f2e2dSJohn Marino /* TYPE_INSTANCE is used when the user specifies a specific 92*cf7f2e2dSJohn Marino type instantiation for overloaded methods/functions. 93*cf7f2e2dSJohn Marino 94*cf7f2e2dSJohn Marino The format is: 95*cf7f2e2dSJohn Marino TYPE_INSTANCE num_types type0 ... typeN num_types TYPE_INSTANCE */ 96*cf7f2e2dSJohn Marino TYPE_INSTANCE, 97*cf7f2e2dSJohn Marino 985796c8dcSSimon Schubert /* end of C++. */ 995796c8dcSSimon Schubert 1005796c8dcSSimon Schubert /* For Modula-2 integer division DIV */ 1015796c8dcSSimon Schubert BINOP_INTDIV, 1025796c8dcSSimon Schubert 1035796c8dcSSimon Schubert BINOP_ASSIGN_MODIFY, /* +=, -=, *=, and so on. 1045796c8dcSSimon Schubert The following exp_element is another opcode, 1055796c8dcSSimon Schubert a BINOP_, saying how to modify. 1065796c8dcSSimon Schubert Then comes another BINOP_ASSIGN_MODIFY, 1075796c8dcSSimon Schubert making three exp_elements in total. */ 1085796c8dcSSimon Schubert 1095796c8dcSSimon Schubert /* Modula-2 standard (binary) procedures */ 1105796c8dcSSimon Schubert BINOP_VAL, 1115796c8dcSSimon Schubert 1125796c8dcSSimon Schubert /* Concatenate two operands, such as character strings or bitstrings. 1135796c8dcSSimon Schubert If the first operand is a integer expression, then it means concatenate 1145796c8dcSSimon Schubert the second operand with itself that many times. */ 1155796c8dcSSimon Schubert BINOP_CONCAT, 1165796c8dcSSimon Schubert 1175796c8dcSSimon Schubert /* For (the deleted) Chill and Pascal. */ 1185796c8dcSSimon Schubert BINOP_IN, /* Returns 1 iff ARG1 IN ARG2. */ 1195796c8dcSSimon Schubert 1205796c8dcSSimon Schubert /* This is the "colon operator" used various places in (the 1215796c8dcSSimon Schubert deleted) Chill. */ 1225796c8dcSSimon Schubert BINOP_RANGE, 1235796c8dcSSimon Schubert 1245796c8dcSSimon Schubert /* This must be the highest BINOP_ value, for expprint.c. */ 1255796c8dcSSimon Schubert BINOP_END, 1265796c8dcSSimon Schubert 1275796c8dcSSimon Schubert /* Operates on three values computed by following subexpressions. */ 1285796c8dcSSimon Schubert TERNOP_COND, /* ?: */ 1295796c8dcSSimon Schubert 1305796c8dcSSimon Schubert /* A sub-string/sub-array. (the deleted) Chill syntax: 1315796c8dcSSimon Schubert OP1(OP2:OP3). Return elements OP2 through OP3 of OP1. */ 1325796c8dcSSimon Schubert TERNOP_SLICE, 1335796c8dcSSimon Schubert 1345796c8dcSSimon Schubert /* A sub-string/sub-array. (The deleted) Chill syntax: OP1(OP2 UP 1355796c8dcSSimon Schubert OP3). Return OP3 elements of OP1, starting with element 1365796c8dcSSimon Schubert OP2. */ 1375796c8dcSSimon Schubert TERNOP_SLICE_COUNT, 1385796c8dcSSimon Schubert 1395796c8dcSSimon Schubert /* Multidimensional subscript operator, such as Modula-2 x[a,b,...]. 1405796c8dcSSimon Schubert The dimensionality is encoded in the operator, like the number of 1415796c8dcSSimon Schubert function arguments in OP_FUNCALL, I.E. <OP><dimension><OP>. 1425796c8dcSSimon Schubert The value of the first following subexpression is subscripted 1435796c8dcSSimon Schubert by each of the next following subexpressions, one per dimension. */ 1445796c8dcSSimon Schubert MULTI_SUBSCRIPT, 1455796c8dcSSimon Schubert 1465796c8dcSSimon Schubert /* The OP_... series take immediate following arguments. 1475796c8dcSSimon Schubert After the arguments come another OP_... (the same one) 1485796c8dcSSimon Schubert so that the grouping can be recognized from the end. */ 1495796c8dcSSimon Schubert 1505796c8dcSSimon Schubert /* OP_LONG is followed by a type pointer in the next exp_element 1515796c8dcSSimon Schubert and the long constant value in the following exp_element. 1525796c8dcSSimon Schubert Then comes another OP_LONG. 1535796c8dcSSimon Schubert Thus, the operation occupies four exp_elements. */ 1545796c8dcSSimon Schubert OP_LONG, 1555796c8dcSSimon Schubert 1565796c8dcSSimon Schubert /* OP_DOUBLE is similar but takes a DOUBLEST constant instead of a long. */ 1575796c8dcSSimon Schubert OP_DOUBLE, 1585796c8dcSSimon Schubert 1595796c8dcSSimon Schubert /* OP_VAR_VALUE takes one struct block * in the following element, 1605796c8dcSSimon Schubert and one struct symbol * in the following exp_element, followed by 1615796c8dcSSimon Schubert another OP_VAR_VALUE, making four exp_elements. If the block is 1625796c8dcSSimon Schubert non-NULL, evaluate the symbol relative to the innermost frame 1635796c8dcSSimon Schubert executing in that block; if the block is NULL use the selected frame. */ 1645796c8dcSSimon Schubert OP_VAR_VALUE, 1655796c8dcSSimon Schubert 1665796c8dcSSimon Schubert /* OP_LAST is followed by an integer in the next exp_element. 1675796c8dcSSimon Schubert The integer is zero for the last value printed, 1685796c8dcSSimon Schubert or it is the absolute number of a history element. 1695796c8dcSSimon Schubert With another OP_LAST at the end, this makes three exp_elements. */ 1705796c8dcSSimon Schubert OP_LAST, 1715796c8dcSSimon Schubert 1725796c8dcSSimon Schubert /* OP_REGISTER is followed by a string in the next exp_element. 1735796c8dcSSimon Schubert This is the name of a register to fetch. */ 1745796c8dcSSimon Schubert OP_REGISTER, 1755796c8dcSSimon Schubert 1765796c8dcSSimon Schubert /* OP_INTERNALVAR is followed by an internalvar ptr in the next exp_element. 1775796c8dcSSimon Schubert With another OP_INTERNALVAR at the end, this makes three exp_elements. */ 1785796c8dcSSimon Schubert OP_INTERNALVAR, 1795796c8dcSSimon Schubert 1805796c8dcSSimon Schubert /* OP_FUNCALL is followed by an integer in the next exp_element. 1815796c8dcSSimon Schubert The integer is the number of args to the function call. 1825796c8dcSSimon Schubert That many plus one values from following subexpressions 1835796c8dcSSimon Schubert are used, the first one being the function. 1845796c8dcSSimon Schubert The integer is followed by a repeat of OP_FUNCALL, 1855796c8dcSSimon Schubert making three exp_elements. */ 1865796c8dcSSimon Schubert OP_FUNCALL, 1875796c8dcSSimon Schubert 1885796c8dcSSimon Schubert /* OP_OBJC_MSGCALL is followed by a string in the next exp_element and then an 1895796c8dcSSimon Schubert integer. The string is the selector string. The integer is the number 1905796c8dcSSimon Schubert of arguments to the message call. That many plus one values are used, 1915796c8dcSSimon Schubert the first one being the object pointer. This is an Objective C message */ 1925796c8dcSSimon Schubert OP_OBJC_MSGCALL, 1935796c8dcSSimon Schubert 1945796c8dcSSimon Schubert /* This is EXACTLY like OP_FUNCALL but is semantically different. 1955796c8dcSSimon Schubert In F77, array subscript expressions, substring expressions 1965796c8dcSSimon Schubert and function calls are all exactly the same syntactically. They may 1975796c8dcSSimon Schubert only be disambiguated at runtime. Thus this operator, which 1985796c8dcSSimon Schubert indicates that we have found something of the form <name> ( <stuff> ) */ 1995796c8dcSSimon Schubert OP_F77_UNDETERMINED_ARGLIST, 2005796c8dcSSimon Schubert 2015796c8dcSSimon Schubert /* OP_COMPLEX takes a type in the following element, followed by another 2025796c8dcSSimon Schubert OP_COMPLEX, making three exp_elements. It is followed by two double 2035796c8dcSSimon Schubert args, and converts them into a complex number of the given type. */ 2045796c8dcSSimon Schubert OP_COMPLEX, 2055796c8dcSSimon Schubert 2065796c8dcSSimon Schubert /* OP_STRING represents a string constant. 2075796c8dcSSimon Schubert Its format is the same as that of a STRUCTOP, but the string 2085796c8dcSSimon Schubert data is just made into a string constant when the operation 2095796c8dcSSimon Schubert is executed. */ 2105796c8dcSSimon Schubert OP_STRING, 2115796c8dcSSimon Schubert 2125796c8dcSSimon Schubert /* OP_BITSTRING represents a packed bitstring constant. 2135796c8dcSSimon Schubert Its format is the same as that of a STRUCTOP, but the bitstring 2145796c8dcSSimon Schubert data is just made into a bitstring constant when the operation 2155796c8dcSSimon Schubert is executed. */ 2165796c8dcSSimon Schubert OP_BITSTRING, 2175796c8dcSSimon Schubert 2185796c8dcSSimon Schubert /* OP_ARRAY creates an array constant out of the following subexpressions. 2195796c8dcSSimon Schubert It is followed by two exp_elements, the first containing an integer 2205796c8dcSSimon Schubert that is the lower bound of the array and the second containing another 2215796c8dcSSimon Schubert integer that is the upper bound of the array. The second integer is 2225796c8dcSSimon Schubert followed by a repeat of OP_ARRAY, making four exp_elements total. 2235796c8dcSSimon Schubert The bounds are used to compute the number of following subexpressions 2245796c8dcSSimon Schubert to consume, as well as setting the bounds in the created array constant. 2255796c8dcSSimon Schubert The type of the elements is taken from the type of the first subexp, 2265796c8dcSSimon Schubert and they must all match. */ 2275796c8dcSSimon Schubert OP_ARRAY, 2285796c8dcSSimon Schubert 2295796c8dcSSimon Schubert /* UNOP_CAST is followed by a type pointer in the next exp_element. 2305796c8dcSSimon Schubert With another UNOP_CAST at the end, this makes three exp_elements. 2315796c8dcSSimon Schubert It casts the value of the following subexpression. */ 2325796c8dcSSimon Schubert UNOP_CAST, 2335796c8dcSSimon Schubert 234*cf7f2e2dSJohn Marino /* The C++ dynamic_cast operator. */ 235*cf7f2e2dSJohn Marino UNOP_DYNAMIC_CAST, 236*cf7f2e2dSJohn Marino 237*cf7f2e2dSJohn Marino /* The C++ reinterpret_cast operator. */ 238*cf7f2e2dSJohn Marino UNOP_REINTERPRET_CAST, 239*cf7f2e2dSJohn Marino 2405796c8dcSSimon Schubert /* UNOP_MEMVAL is followed by a type pointer in the next exp_element 2415796c8dcSSimon Schubert With another UNOP_MEMVAL at the end, this makes three exp_elements. 2425796c8dcSSimon Schubert It casts the contents of the word addressed by the value of the 2435796c8dcSSimon Schubert following subexpression. */ 2445796c8dcSSimon Schubert UNOP_MEMVAL, 2455796c8dcSSimon Schubert 2465796c8dcSSimon Schubert /* UNOP_MEMVAL_TLS is followed by a `struct objfile' pointer in the next 2475796c8dcSSimon Schubert exp_element and a type pointer in the following exp_element. 2485796c8dcSSimon Schubert With another UNOP_MEMVAL_TLS at the end, this makes four exp_elements. 2495796c8dcSSimon Schubert It casts the contents of the word offsetted by the value of the 2505796c8dcSSimon Schubert following subexpression from the TLS specified by `struct objfile'. */ 2515796c8dcSSimon Schubert UNOP_MEMVAL_TLS, 2525796c8dcSSimon Schubert 2535796c8dcSSimon Schubert /* UNOP_... operate on one value from a following subexpression 2545796c8dcSSimon Schubert and replace it with a result. They take no immediate arguments. */ 2555796c8dcSSimon Schubert 2565796c8dcSSimon Schubert UNOP_NEG, /* Unary - */ 2575796c8dcSSimon Schubert UNOP_LOGICAL_NOT, /* Unary ! */ 2585796c8dcSSimon Schubert UNOP_COMPLEMENT, /* Unary ~ */ 2595796c8dcSSimon Schubert UNOP_IND, /* Unary * */ 2605796c8dcSSimon Schubert UNOP_ADDR, /* Unary & */ 2615796c8dcSSimon Schubert UNOP_PREINCREMENT, /* ++ before an expression */ 2625796c8dcSSimon Schubert UNOP_POSTINCREMENT, /* ++ after an expression */ 2635796c8dcSSimon Schubert UNOP_PREDECREMENT, /* -- before an expression */ 2645796c8dcSSimon Schubert UNOP_POSTDECREMENT, /* -- after an expression */ 2655796c8dcSSimon Schubert UNOP_SIZEOF, /* Unary sizeof (followed by expression) */ 2665796c8dcSSimon Schubert 2675796c8dcSSimon Schubert UNOP_PLUS, /* Unary plus */ 2685796c8dcSSimon Schubert 2695796c8dcSSimon Schubert UNOP_CAP, /* Modula-2 standard (unary) procedures */ 2705796c8dcSSimon Schubert UNOP_CHR, 2715796c8dcSSimon Schubert UNOP_ORD, 2725796c8dcSSimon Schubert UNOP_ABS, 2735796c8dcSSimon Schubert UNOP_FLOAT, 2745796c8dcSSimon Schubert UNOP_HIGH, 2755796c8dcSSimon Schubert UNOP_MAX, 2765796c8dcSSimon Schubert UNOP_MIN, 2775796c8dcSSimon Schubert UNOP_ODD, 2785796c8dcSSimon Schubert UNOP_TRUNC, 2795796c8dcSSimon Schubert 2805796c8dcSSimon Schubert OP_BOOL, /* Modula-2 builtin BOOLEAN type */ 2815796c8dcSSimon Schubert OP_M2_STRING, /* Modula-2 string constants */ 2825796c8dcSSimon Schubert 2835796c8dcSSimon Schubert /* STRUCTOP_... operate on a value from a following subexpression 2845796c8dcSSimon Schubert by extracting a structure component specified by a string 2855796c8dcSSimon Schubert that appears in the following exp_elements (as many as needed). 2865796c8dcSSimon Schubert STRUCTOP_STRUCT is used for "." and STRUCTOP_PTR for "->". 2875796c8dcSSimon Schubert They differ only in the error message given in case the value is 2885796c8dcSSimon Schubert not suitable or the structure component specified is not found. 2895796c8dcSSimon Schubert 2905796c8dcSSimon Schubert The length of the string follows the opcode, followed by 2915796c8dcSSimon Schubert BYTES_TO_EXP_ELEM(length) elements containing the data of the 2925796c8dcSSimon Schubert string, followed by the length again and the opcode again. */ 2935796c8dcSSimon Schubert 2945796c8dcSSimon Schubert STRUCTOP_STRUCT, 2955796c8dcSSimon Schubert STRUCTOP_PTR, 2965796c8dcSSimon Schubert 2975796c8dcSSimon Schubert /* C++: OP_THIS is just a placeholder for the class instance variable. 2985796c8dcSSimon Schubert It just comes in a tight (OP_THIS, OP_THIS) pair. */ 2995796c8dcSSimon Schubert OP_THIS, 3005796c8dcSSimon Schubert 3015796c8dcSSimon Schubert /* Objective-C: OP_OBJC_SELF is just a placeholder for the class instance 3025796c8dcSSimon Schubert variable. It just comes in a tight (OP_OBJC_SELF, OP_OBJC_SELF) pair. */ 3035796c8dcSSimon Schubert OP_OBJC_SELF, 3045796c8dcSSimon Schubert 3055796c8dcSSimon Schubert /* Objective C: "@selector" pseudo-operator */ 3065796c8dcSSimon Schubert OP_OBJC_SELECTOR, 3075796c8dcSSimon Schubert 3085796c8dcSSimon Schubert /* OP_SCOPE surrounds a type name and a field name. The type 3095796c8dcSSimon Schubert name is encoded as one element, but the field name stays as 3105796c8dcSSimon Schubert a string, which, of course, is variable length. */ 3115796c8dcSSimon Schubert OP_SCOPE, 3125796c8dcSSimon Schubert 3135796c8dcSSimon Schubert /* Used to represent named structure field values in brace 3145796c8dcSSimon Schubert initializers (or tuples as they are called in (the deleted) 3155796c8dcSSimon Schubert Chill). 3165796c8dcSSimon Schubert 3175796c8dcSSimon Schubert The gcc C syntax is NAME:VALUE or .NAME=VALUE, the (the 3185796c8dcSSimon Schubert deleted) Chill syntax is .NAME:VALUE. Multiple labels (as in 3195796c8dcSSimon Schubert the (the deleted) Chill syntax .NAME1,.NAME2:VALUE) is 3205796c8dcSSimon Schubert represented as if it were .NAME1:(.NAME2:VALUE) (though that is 3215796c8dcSSimon Schubert not valid (the deleted) Chill syntax). 3225796c8dcSSimon Schubert 3235796c8dcSSimon Schubert The NAME is represented as for STRUCTOP_STRUCT; VALUE follows. */ 3245796c8dcSSimon Schubert OP_LABELED, 3255796c8dcSSimon Schubert 3265796c8dcSSimon Schubert /* OP_TYPE is for parsing types, and used with the "ptype" command 3275796c8dcSSimon Schubert so we can look up types that are qualified by scope, either with 3285796c8dcSSimon Schubert the GDB "::" operator, or the Modula-2 '.' operator. */ 3295796c8dcSSimon Schubert OP_TYPE, 3305796c8dcSSimon Schubert 3315796c8dcSSimon Schubert /* An un-looked-up identifier. */ 3325796c8dcSSimon Schubert OP_NAME, 3335796c8dcSSimon Schubert 3345796c8dcSSimon Schubert /* An Objective C Foundation Class NSString constant */ 3355796c8dcSSimon Schubert OP_OBJC_NSSTRING, 3365796c8dcSSimon Schubert 3375796c8dcSSimon Schubert /* A F90 array range operator (for "exp:exp", "exp:", ":exp" and ":"). */ 3385796c8dcSSimon Schubert OP_F90_RANGE, 3395796c8dcSSimon Schubert 3405796c8dcSSimon Schubert /* OP_DECFLOAT is followed by a type pointer in the next exp_element 3415796c8dcSSimon Schubert and a dec long constant value in the following exp_element. 3425796c8dcSSimon Schubert Then comes another OP_DECFLOAT. */ 3435796c8dcSSimon Schubert OP_DECFLOAT, 3445796c8dcSSimon Schubert 345*cf7f2e2dSJohn Marino /* OP_ADL_FUNC specifies that the function is to be looked up in an 346*cf7f2e2dSJohn Marino Argument Dependent manner (Koenig lookup). */ 347*cf7f2e2dSJohn Marino OP_ADL_FUNC, 348*cf7f2e2dSJohn Marino 3495796c8dcSSimon Schubert /* First extension operator. Individual language modules define 3505796c8dcSSimon Schubert extra operators in *.inc include files below always starting with 3515796c8dcSSimon Schubert numbering at OP_EXTENDED0: 3525796c8dcSSimon Schubert BINOP_MOGRIFY = OP_EXTENDED0, 3535796c8dcSSimon Schubert BINOP_FROB, 3545796c8dcSSimon Schubert ... */ 3555796c8dcSSimon Schubert OP_EXTENDED0, 3565796c8dcSSimon Schubert 3575796c8dcSSimon Schubert /* Last possible extension operator. Defined to provide an 3585796c8dcSSimon Schubert explicit and finite number of extended operators. */ 3595796c8dcSSimon Schubert OP_EXTENDED_LAST = 0xff, 3605796c8dcSSimon Schubert /* NOTE: Eventually, we expect to convert to an object-oriented 3615796c8dcSSimon Schubert formulation for expression operators that does away with the 3625796c8dcSSimon Schubert need for these extension operators, and indeed for this 3635796c8dcSSimon Schubert entire enumeration type. Therefore, consider the OP_EXTENDED 3645796c8dcSSimon Schubert definitions to be a temporary measure. */ 3655796c8dcSSimon Schubert 3665796c8dcSSimon Schubert /* Each language specific set of operators starts at OP_EXTENDED0. */ 3675796c8dcSSimon Schubert #include "ada-operator.inc" 3685796c8dcSSimon Schubert 3695796c8dcSSimon Schubert /* Existing only to swallow the last comma (',') from last .inc file. */ 3705796c8dcSSimon Schubert OP_UNUSED_LAST 3715796c8dcSSimon Schubert }; 3725796c8dcSSimon Schubert 3735796c8dcSSimon Schubert union exp_element 3745796c8dcSSimon Schubert { 3755796c8dcSSimon Schubert enum exp_opcode opcode; 3765796c8dcSSimon Schubert struct symbol *symbol; 3775796c8dcSSimon Schubert LONGEST longconst; 3785796c8dcSSimon Schubert DOUBLEST doubleconst; 3795796c8dcSSimon Schubert gdb_byte decfloatconst[16]; 3805796c8dcSSimon Schubert /* Really sizeof (union exp_element) characters (or less for the last 3815796c8dcSSimon Schubert element of a string). */ 3825796c8dcSSimon Schubert char string; 3835796c8dcSSimon Schubert struct type *type; 3845796c8dcSSimon Schubert struct internalvar *internalvar; 3855796c8dcSSimon Schubert struct block *block; 3865796c8dcSSimon Schubert struct objfile *objfile; 3875796c8dcSSimon Schubert }; 3885796c8dcSSimon Schubert 3895796c8dcSSimon Schubert struct expression 3905796c8dcSSimon Schubert { 3915796c8dcSSimon Schubert const struct language_defn *language_defn; /* language it was entered in */ 3925796c8dcSSimon Schubert struct gdbarch *gdbarch; /* architecture it was parsed in */ 3935796c8dcSSimon Schubert int nelts; 3945796c8dcSSimon Schubert union exp_element elts[1]; 3955796c8dcSSimon Schubert }; 3965796c8dcSSimon Schubert 3975796c8dcSSimon Schubert /* Macros for converting between number of expression elements and bytes 3985796c8dcSSimon Schubert to store that many expression elements. */ 3995796c8dcSSimon Schubert 4005796c8dcSSimon Schubert #define EXP_ELEM_TO_BYTES(elements) \ 4015796c8dcSSimon Schubert ((elements) * sizeof (union exp_element)) 4025796c8dcSSimon Schubert #define BYTES_TO_EXP_ELEM(bytes) \ 4035796c8dcSSimon Schubert (((bytes) + sizeof (union exp_element) - 1) / sizeof (union exp_element)) 4045796c8dcSSimon Schubert 4055796c8dcSSimon Schubert /* From parse.c */ 4065796c8dcSSimon Schubert 4075796c8dcSSimon Schubert extern struct expression *parse_expression (char *); 4085796c8dcSSimon Schubert 4095796c8dcSSimon Schubert extern struct type *parse_field_expression (char *, char **); 4105796c8dcSSimon Schubert 4115796c8dcSSimon Schubert extern struct expression *parse_exp_1 (char **, struct block *, int); 4125796c8dcSSimon Schubert 4135796c8dcSSimon Schubert /* For use by parsers; set if we want to parse an expression and 4145796c8dcSSimon Schubert attempt to complete a field name. */ 4155796c8dcSSimon Schubert extern int in_parse_field; 4165796c8dcSSimon Schubert 4175796c8dcSSimon Schubert /* The innermost context required by the stack and register variables 4185796c8dcSSimon Schubert we've encountered so far. To use this, set it to NULL, then call 4195796c8dcSSimon Schubert parse_<whatever>, then look at it. */ 4205796c8dcSSimon Schubert extern struct block *innermost_block; 4215796c8dcSSimon Schubert 4225796c8dcSSimon Schubert /* From eval.c */ 4235796c8dcSSimon Schubert 4245796c8dcSSimon Schubert /* Values of NOSIDE argument to eval_subexp. */ 4255796c8dcSSimon Schubert 4265796c8dcSSimon Schubert enum noside 4275796c8dcSSimon Schubert { 4285796c8dcSSimon Schubert EVAL_NORMAL, 4295796c8dcSSimon Schubert EVAL_SKIP, /* Only effect is to increment pos. */ 4305796c8dcSSimon Schubert EVAL_AVOID_SIDE_EFFECTS /* Don't modify any variables or 4315796c8dcSSimon Schubert call any functions. The value 4325796c8dcSSimon Schubert returned will have the correct 4335796c8dcSSimon Schubert type, and will have an 4345796c8dcSSimon Schubert approximately correct lvalue 4355796c8dcSSimon Schubert type (inaccuracy: anything that is 4365796c8dcSSimon Schubert listed as being in a register in 4375796c8dcSSimon Schubert the function in which it was 4385796c8dcSSimon Schubert declared will be lval_register). */ 4395796c8dcSSimon Schubert }; 4405796c8dcSSimon Schubert 4415796c8dcSSimon Schubert extern struct value *evaluate_subexp_standard 4425796c8dcSSimon Schubert (struct type *, struct expression *, int *, enum noside); 4435796c8dcSSimon Schubert 4445796c8dcSSimon Schubert /* From expprint.c */ 4455796c8dcSSimon Schubert 4465796c8dcSSimon Schubert extern void print_expression (struct expression *, struct ui_file *); 4475796c8dcSSimon Schubert 4485796c8dcSSimon Schubert extern char *op_string (enum exp_opcode); 4495796c8dcSSimon Schubert 4505796c8dcSSimon Schubert extern void dump_raw_expression (struct expression *, struct ui_file *, char *); 4515796c8dcSSimon Schubert extern void dump_prefix_expression (struct expression *, struct ui_file *); 4525796c8dcSSimon Schubert 4535796c8dcSSimon Schubert #endif /* !defined (EXPRESSION_H) */ 454