| 1 | /* Print in infix form a struct expression. |
| 2 | Copyright (C) 1986, 1989, 1991 Free Software Foundation, Inc. |
| 3 | |
| 4 | This file is part of GDB. |
| 5 | |
| 6 | This program is free software; you can redistribute it and/or modify |
| 7 | it under the terms of the GNU General Public License as published by |
| 8 | the Free Software Foundation; either version 2 of the License, or |
| 9 | (at your option) any later version. |
| 10 | |
| 11 | This program is distributed in the hope that it will be useful, |
| 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | GNU General Public License for more details. |
| 15 | |
| 16 | You should have received a copy of the GNU General Public License |
| 17 | along with this program; if not, write to the Free Software |
| 18 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ |
| 19 | |
| 20 | #include "defs.h" |
| 21 | #include "symtab.h" |
| 22 | #include "gdbtypes.h" |
| 23 | #include "expression.h" |
| 24 | #include "value.h" |
| 25 | #include "language.h" |
| 26 | #include "parser-defs.h" |
| 27 | |
| 28 | /* Prototypes for local functions */ |
| 29 | |
| 30 | static void |
| 31 | print_subexp PARAMS ((struct expression *, int *, FILE *, enum precedence)); |
| 32 | |
| 33 | static void |
| 34 | print_simple_m2_func PARAMS ((char *, struct expression *, int *, FILE *)); |
| 35 | |
| 36 | void |
| 37 | print_expression (exp, stream) |
| 38 | struct expression *exp; |
| 39 | FILE *stream; |
| 40 | { |
| 41 | int pc = 0; |
| 42 | print_subexp (exp, &pc, stream, PREC_NULL); |
| 43 | } |
| 44 | |
| 45 | /* Print the subexpression of EXP that starts in position POS, on STREAM. |
| 46 | PREC is the precedence of the surrounding operator; |
| 47 | if the precedence of the main operator of this subexpression is less, |
| 48 | parentheses are needed here. */ |
| 49 | |
| 50 | static void |
| 51 | print_subexp (exp, pos, stream, prec) |
| 52 | register struct expression *exp; |
| 53 | register int *pos; |
| 54 | FILE *stream; |
| 55 | enum precedence prec; |
| 56 | { |
| 57 | register unsigned tem; |
| 58 | register const struct op_print *op_print_tab; |
| 59 | register int pc; |
| 60 | unsigned nargs; |
| 61 | register char *op_str; |
| 62 | int assign_modify = 0; |
| 63 | enum exp_opcode opcode; |
| 64 | enum precedence myprec; |
| 65 | /* Set to 1 for a right-associative operator. */ |
| 66 | int assoc; |
| 67 | value val; |
| 68 | char *tempstr; |
| 69 | |
| 70 | op_print_tab = exp->language_defn->la_op_print_tab; |
| 71 | pc = (*pos)++; |
| 72 | opcode = exp->elts[pc].opcode; |
| 73 | switch (opcode) |
| 74 | { |
| 75 | /* Common ops */ |
| 76 | |
| 77 | case OP_SCOPE: |
| 78 | myprec = PREC_PREFIX; |
| 79 | assoc = 0; |
| 80 | fputs_filtered (type_name_no_tag (exp->elts[pc + 1].type), stream); |
| 81 | fputs_filtered ("::", stream); |
| 82 | nargs = longest_to_int (exp->elts[pc + 2].longconst); |
| 83 | (*pos) += 4 + BYTES_TO_EXP_ELEM (nargs + 1); |
| 84 | fputs_filtered (&exp->elts[pc + 3].string, stream); |
| 85 | return; |
| 86 | |
| 87 | case OP_LONG: |
| 88 | (*pos) += 3; |
| 89 | value_print (value_from_longest (exp->elts[pc + 1].type, |
| 90 | exp->elts[pc + 2].longconst), |
| 91 | stream, 0, Val_no_prettyprint); |
| 92 | return; |
| 93 | |
| 94 | case OP_DOUBLE: |
| 95 | (*pos) += 3; |
| 96 | value_print (value_from_double (exp->elts[pc + 1].type, |
| 97 | exp->elts[pc + 2].doubleconst), |
| 98 | stream, 0, Val_no_prettyprint); |
| 99 | return; |
| 100 | |
| 101 | case OP_VAR_VALUE: |
| 102 | (*pos) += 2; |
| 103 | fputs_filtered (SYMBOL_SOURCE_NAME (exp->elts[pc + 1].symbol), stream); |
| 104 | return; |
| 105 | |
| 106 | case OP_LAST: |
| 107 | (*pos) += 2; |
| 108 | fprintf_filtered (stream, "$%d", |
| 109 | longest_to_int (exp->elts[pc + 1].longconst)); |
| 110 | return; |
| 111 | |
| 112 | case OP_REGISTER: |
| 113 | (*pos) += 2; |
| 114 | fprintf_filtered (stream, "$%s", |
| 115 | reg_names[longest_to_int (exp->elts[pc + 1].longconst)]); |
| 116 | return; |
| 117 | |
| 118 | case OP_BOOL: |
| 119 | (*pos) += 2; |
| 120 | fprintf_filtered (stream, "%s", |
| 121 | longest_to_int (exp->elts[pc + 1].longconst) |
| 122 | ? "TRUE" : "FALSE"); |
| 123 | return; |
| 124 | |
| 125 | case OP_INTERNALVAR: |
| 126 | (*pos) += 2; |
| 127 | fprintf_filtered (stream, "$%s", |
| 128 | internalvar_name (exp->elts[pc + 1].internalvar)); |
| 129 | return; |
| 130 | |
| 131 | case OP_FUNCALL: |
| 132 | (*pos) += 2; |
| 133 | nargs = longest_to_int (exp->elts[pc + 1].longconst); |
| 134 | print_subexp (exp, pos, stream, PREC_SUFFIX); |
| 135 | fputs_filtered (" (", stream); |
| 136 | for (tem = 0; tem < nargs; tem++) |
| 137 | { |
| 138 | if (tem != 0) |
| 139 | fputs_filtered (", ", stream); |
| 140 | print_subexp (exp, pos, stream, PREC_ABOVE_COMMA); |
| 141 | } |
| 142 | fputs_filtered (")", stream); |
| 143 | return; |
| 144 | |
| 145 | case OP_STRING: |
| 146 | nargs = longest_to_int (exp -> elts[pc + 1].longconst); |
| 147 | (*pos) += 3 + BYTES_TO_EXP_ELEM (nargs + 1); |
| 148 | /* LA_PRINT_STRING will print using the current repeat count threshold. |
| 149 | If necessary, we can temporarily set it to zero, or pass it as an |
| 150 | additional parameter to LA_PRINT_STRING. -fnf */ |
| 151 | LA_PRINT_STRING (stream, &exp->elts[pc + 2].string, nargs, 0); |
| 152 | return; |
| 153 | |
| 154 | case OP_BITSTRING: |
| 155 | error ("support for OP_BITSTRING unimplemented"); |
| 156 | break; |
| 157 | |
| 158 | case OP_ARRAY: |
| 159 | (*pos) += 3; |
| 160 | nargs = longest_to_int (exp->elts[pc + 2].longconst); |
| 161 | nargs -= longest_to_int (exp->elts[pc + 1].longconst); |
| 162 | nargs++; |
| 163 | tem = 0; |
| 164 | if (exp->elts[pc + 4].opcode == OP_LONG |
| 165 | && exp->elts[pc + 5].type == builtin_type_char |
| 166 | && exp->language_defn->la_language == language_c) |
| 167 | { |
| 168 | /* Attempt to print C character arrays using string syntax. |
| 169 | Walk through the args, picking up one character from each |
| 170 | of the OP_LONG expression elements. If any array element |
| 171 | does not match our expection of what we should find for |
| 172 | a simple string, revert back to array printing. Note that |
| 173 | the last expression element is an explicit null terminator |
| 174 | byte, which doesn't get printed. */ |
| 175 | tempstr = alloca (nargs); |
| 176 | pc += 4; |
| 177 | while (tem < nargs) |
| 178 | { |
| 179 | if (exp->elts[pc].opcode != OP_LONG |
| 180 | || exp->elts[pc + 1].type != builtin_type_char) |
| 181 | { |
| 182 | /* Not a simple array of char, use regular array printing. */ |
| 183 | tem = 0; |
| 184 | break; |
| 185 | } |
| 186 | else |
| 187 | { |
| 188 | tempstr[tem++] = |
| 189 | longest_to_int (exp->elts[pc + 2].longconst); |
| 190 | pc += 4; |
| 191 | } |
| 192 | } |
| 193 | } |
| 194 | if (tem > 0) |
| 195 | { |
| 196 | LA_PRINT_STRING (stream, tempstr, nargs - 1, 0); |
| 197 | (*pos) = pc; |
| 198 | } |
| 199 | else |
| 200 | { |
| 201 | fputs_filtered (" {", stream); |
| 202 | for (tem = 0; tem < nargs; tem++) |
| 203 | { |
| 204 | if (tem != 0) |
| 205 | { |
| 206 | fputs_filtered (", ", stream); |
| 207 | } |
| 208 | print_subexp (exp, pos, stream, PREC_ABOVE_COMMA); |
| 209 | } |
| 210 | fputs_filtered ("}", stream); |
| 211 | } |
| 212 | return; |
| 213 | |
| 214 | case TERNOP_COND: |
| 215 | if ((int) prec > (int) PREC_COMMA) |
| 216 | fputs_filtered ("(", stream); |
| 217 | /* Print the subexpressions, forcing parentheses |
| 218 | around any binary operations within them. |
| 219 | This is more parentheses than are strictly necessary, |
| 220 | but it looks clearer. */ |
| 221 | print_subexp (exp, pos, stream, PREC_HYPER); |
| 222 | fputs_filtered (" ? ", stream); |
| 223 | print_subexp (exp, pos, stream, PREC_HYPER); |
| 224 | fputs_filtered (" : ", stream); |
| 225 | print_subexp (exp, pos, stream, PREC_HYPER); |
| 226 | if ((int) prec > (int) PREC_COMMA) |
| 227 | fputs_filtered (")", stream); |
| 228 | return; |
| 229 | |
| 230 | case STRUCTOP_STRUCT: |
| 231 | tem = longest_to_int (exp->elts[pc + 1].longconst); |
| 232 | (*pos) += 3 + BYTES_TO_EXP_ELEM (tem + 1); |
| 233 | print_subexp (exp, pos, stream, PREC_SUFFIX); |
| 234 | fputs_filtered (".", stream); |
| 235 | fputs_filtered (&exp->elts[pc + 2].string, stream); |
| 236 | return; |
| 237 | |
| 238 | /* Will not occur for Modula-2 */ |
| 239 | case STRUCTOP_PTR: |
| 240 | tem = longest_to_int (exp->elts[pc + 1].longconst); |
| 241 | (*pos) += 3 + BYTES_TO_EXP_ELEM (tem + 1); |
| 242 | print_subexp (exp, pos, stream, PREC_SUFFIX); |
| 243 | fputs_filtered ("->", stream); |
| 244 | fputs_filtered (&exp->elts[pc + 2].string, stream); |
| 245 | return; |
| 246 | |
| 247 | case BINOP_SUBSCRIPT: |
| 248 | print_subexp (exp, pos, stream, PREC_SUFFIX); |
| 249 | fputs_filtered ("[", stream); |
| 250 | print_subexp (exp, pos, stream, PREC_ABOVE_COMMA); |
| 251 | fputs_filtered ("]", stream); |
| 252 | return; |
| 253 | |
| 254 | case UNOP_POSTINCREMENT: |
| 255 | print_subexp (exp, pos, stream, PREC_SUFFIX); |
| 256 | fputs_filtered ("++", stream); |
| 257 | return; |
| 258 | |
| 259 | case UNOP_POSTDECREMENT: |
| 260 | print_subexp (exp, pos, stream, PREC_SUFFIX); |
| 261 | fputs_filtered ("--", stream); |
| 262 | return; |
| 263 | |
| 264 | case UNOP_CAST: |
| 265 | (*pos) += 2; |
| 266 | if ((int) prec > (int) PREC_PREFIX) |
| 267 | fputs_filtered ("(", stream); |
| 268 | fputs_filtered ("(", stream); |
| 269 | type_print (exp->elts[pc + 1].type, "", stream, 0); |
| 270 | fputs_filtered (") ", stream); |
| 271 | print_subexp (exp, pos, stream, PREC_PREFIX); |
| 272 | if ((int) prec > (int) PREC_PREFIX) |
| 273 | fputs_filtered (")", stream); |
| 274 | return; |
| 275 | |
| 276 | case UNOP_MEMVAL: |
| 277 | (*pos) += 2; |
| 278 | if ((int) prec > (int) PREC_PREFIX) |
| 279 | fputs_filtered ("(", stream); |
| 280 | if (exp->elts[pc + 1].type->code == TYPE_CODE_FUNC && |
| 281 | exp->elts[pc + 3].opcode == OP_LONG) { |
| 282 | /* We have a minimal symbol fn, probably. It's encoded |
| 283 | as a UNOP_MEMVAL (function-type) of an OP_LONG (int, address). |
| 284 | Swallow the OP_LONG (including both its opcodes); ignore |
| 285 | its type; print the value in the type of the MEMVAL. */ |
| 286 | (*pos) += 4; |
| 287 | val = value_at_lazy (exp->elts[pc + 1].type, |
| 288 | (CORE_ADDR) exp->elts[pc + 5].longconst); |
| 289 | value_print (val, stream, 0, Val_no_prettyprint); |
| 290 | } else { |
| 291 | fputs_filtered ("{", stream); |
| 292 | type_print (exp->elts[pc + 1].type, "", stream, 0); |
| 293 | fputs_filtered ("} ", stream); |
| 294 | print_subexp (exp, pos, stream, PREC_PREFIX); |
| 295 | } |
| 296 | if ((int) prec > (int) PREC_PREFIX) |
| 297 | fputs_filtered (")", stream); |
| 298 | return; |
| 299 | |
| 300 | case BINOP_ASSIGN_MODIFY: |
| 301 | opcode = exp->elts[pc + 1].opcode; |
| 302 | (*pos) += 2; |
| 303 | myprec = PREC_ASSIGN; |
| 304 | assoc = 1; |
| 305 | assign_modify = 1; |
| 306 | op_str = "???"; |
| 307 | for (tem = 0; op_print_tab[tem].opcode != OP_NULL; tem++) |
| 308 | if (op_print_tab[tem].opcode == opcode) |
| 309 | { |
| 310 | op_str = op_print_tab[tem].string; |
| 311 | break; |
| 312 | } |
| 313 | if (op_print_tab[tem].opcode != opcode) |
| 314 | /* Not found; don't try to keep going because we don't know how |
| 315 | to interpret further elements. */ |
| 316 | error ("Invalid expression"); |
| 317 | break; |
| 318 | |
| 319 | /* C++ ops */ |
| 320 | |
| 321 | case OP_THIS: |
| 322 | ++(*pos); |
| 323 | fputs_filtered ("this", stream); |
| 324 | return; |
| 325 | |
| 326 | /* Modula-2 ops */ |
| 327 | |
| 328 | case MULTI_SUBSCRIPT: |
| 329 | (*pos) += 2; |
| 330 | nargs = longest_to_int (exp->elts[pc + 1].longconst); |
| 331 | print_subexp (exp, pos, stream, PREC_SUFFIX); |
| 332 | fprintf (stream, " ["); |
| 333 | for (tem = 0; tem < nargs; tem++) |
| 334 | { |
| 335 | if (tem != 0) |
| 336 | fprintf (stream, ", "); |
| 337 | print_subexp (exp, pos, stream, PREC_ABOVE_COMMA); |
| 338 | } |
| 339 | fprintf (stream, "]"); |
| 340 | return; |
| 341 | |
| 342 | case BINOP_VAL: |
| 343 | (*pos)+=2; |
| 344 | fprintf(stream,"VAL("); |
| 345 | type_print(exp->elts[pc+1].type,"",stream,0); |
| 346 | fprintf(stream,","); |
| 347 | print_subexp(exp,pos,stream,PREC_PREFIX); |
| 348 | fprintf(stream,")"); |
| 349 | return; |
| 350 | |
| 351 | case UNOP_CAP: |
| 352 | print_simple_m2_func("CAP",exp,pos,stream); |
| 353 | return; |
| 354 | |
| 355 | case UNOP_CHR: |
| 356 | print_simple_m2_func("CHR",exp,pos,stream); |
| 357 | return; |
| 358 | |
| 359 | case UNOP_ORD: |
| 360 | print_simple_m2_func("ORD",exp,pos,stream); |
| 361 | return; |
| 362 | |
| 363 | case UNOP_ABS: |
| 364 | print_simple_m2_func("ABS",exp,pos,stream); |
| 365 | return; |
| 366 | |
| 367 | case UNOP_FLOAT: |
| 368 | print_simple_m2_func("FLOAT",exp,pos,stream); |
| 369 | return; |
| 370 | |
| 371 | case UNOP_HIGH: |
| 372 | print_simple_m2_func("HIGH",exp,pos,stream); |
| 373 | return; |
| 374 | |
| 375 | case UNOP_MAX: |
| 376 | print_simple_m2_func("MAX",exp,pos,stream); |
| 377 | return; |
| 378 | |
| 379 | case UNOP_MIN: |
| 380 | print_simple_m2_func("MIN",exp,pos,stream); |
| 381 | return; |
| 382 | |
| 383 | case UNOP_ODD: |
| 384 | print_simple_m2_func("ODD",exp,pos,stream); |
| 385 | return; |
| 386 | |
| 387 | case UNOP_TRUNC: |
| 388 | print_simple_m2_func("TRUNC",exp,pos,stream); |
| 389 | return; |
| 390 | |
| 391 | case BINOP_INCL: |
| 392 | case BINOP_EXCL: |
| 393 | error("print_subexp: Not implemented."); |
| 394 | |
| 395 | /* Default ops */ |
| 396 | |
| 397 | default: |
| 398 | op_str = "???"; |
| 399 | for (tem = 0; op_print_tab[tem].opcode != OP_NULL; tem++) |
| 400 | if (op_print_tab[tem].opcode == opcode) |
| 401 | { |
| 402 | op_str = op_print_tab[tem].string; |
| 403 | myprec = op_print_tab[tem].precedence; |
| 404 | assoc = op_print_tab[tem].right_assoc; |
| 405 | break; |
| 406 | } |
| 407 | if (op_print_tab[tem].opcode != opcode) |
| 408 | /* Not found; don't try to keep going because we don't know how |
| 409 | to interpret further elements. For example, this happens |
| 410 | if opcode is OP_TYPE. */ |
| 411 | error ("Invalid expression"); |
| 412 | } |
| 413 | |
| 414 | if ((int) myprec < (int) prec) |
| 415 | fputs_filtered ("(", stream); |
| 416 | if ((int) opcode > (int) BINOP_END) |
| 417 | { |
| 418 | /* Unary prefix operator. */ |
| 419 | fputs_filtered (op_str, stream); |
| 420 | print_subexp (exp, pos, stream, PREC_PREFIX); |
| 421 | } |
| 422 | else |
| 423 | { |
| 424 | /* Binary operator. */ |
| 425 | /* Print left operand. |
| 426 | If operator is right-associative, |
| 427 | increment precedence for this operand. */ |
| 428 | print_subexp (exp, pos, stream, |
| 429 | (enum precedence) ((int) myprec + assoc)); |
| 430 | /* Print the operator itself. */ |
| 431 | if (assign_modify) |
| 432 | fprintf_filtered (stream, " %s= ", op_str); |
| 433 | else if (op_str[0] == ',') |
| 434 | fprintf_filtered (stream, "%s ", op_str); |
| 435 | else |
| 436 | fprintf_filtered (stream, " %s ", op_str); |
| 437 | /* Print right operand. |
| 438 | If operator is left-associative, |
| 439 | increment precedence for this operand. */ |
| 440 | print_subexp (exp, pos, stream, |
| 441 | (enum precedence) ((int) myprec + !assoc)); |
| 442 | } |
| 443 | |
| 444 | if ((int) myprec < (int) prec) |
| 445 | fputs_filtered (")", stream); |
| 446 | } |
| 447 | |
| 448 | /* Print out something of the form <s>(<arg>). |
| 449 | This is used to print out some builtin Modula-2 |
| 450 | functions. |
| 451 | FIXME: There is probably some way to get the precedence |
| 452 | rules to do this (print a unary operand with parens around it). */ |
| 453 | static void |
| 454 | print_simple_m2_func(s,exp,pos,stream) |
| 455 | char *s; |
| 456 | register struct expression *exp; |
| 457 | register int *pos; |
| 458 | FILE *stream; |
| 459 | { |
| 460 | fprintf(stream,"%s(",s); |
| 461 | print_subexp(exp,pos,stream,PREC_PREFIX); |
| 462 | fprintf(stream,")"); |
| 463 | } |
| 464 | |
| 465 | /* Return the operator corresponding to opcode OP as |
| 466 | a string. NULL indicates that the opcode was not found in the |
| 467 | current language table. */ |
| 468 | char * |
| 469 | op_string(op) |
| 470 | enum exp_opcode op; |
| 471 | { |
| 472 | int tem; |
| 473 | register const struct op_print *op_print_tab; |
| 474 | |
| 475 | op_print_tab = current_language->la_op_print_tab; |
| 476 | for (tem = 0; op_print_tab[tem].opcode != OP_NULL; tem++) |
| 477 | if (op_print_tab[tem].opcode == op) |
| 478 | return op_print_tab[tem].string; |
| 479 | return NULL; |
| 480 | } |
| 481 | |
| 482 | #ifdef DEBUG_EXPRESSIONS |
| 483 | |
| 484 | /* Support for dumping the raw data from expressions in a human readable |
| 485 | form. */ |
| 486 | |
| 487 | void |
| 488 | dump_expression (exp, stream, note) |
| 489 | struct expression *exp; |
| 490 | FILE *stream; |
| 491 | char *note; |
| 492 | { |
| 493 | int elt; |
| 494 | char *opcode_name; |
| 495 | char *eltscan; |
| 496 | int eltsize; |
| 497 | |
| 498 | fprintf_filtered (stream, "Dump of expression @ 0x%x, %s:\n", exp, note); |
| 499 | fprintf_filtered (stream, "\tLanguage %s, %d elements, %d bytes each.\n", |
| 500 | exp->language_defn->la_name, exp -> nelts, |
| 501 | sizeof (union exp_element)); |
| 502 | fprintf_filtered (stream, "\t%5s %20s %16s %s\n", "Index", "Opcode", |
| 503 | "Hex Value", "String Value"); |
| 504 | for (elt = 0; elt < exp -> nelts; elt++) |
| 505 | { |
| 506 | fprintf_filtered (stream, "\t%5d ", elt); |
| 507 | switch (exp -> elts[elt].opcode) |
| 508 | { |
| 509 | default: opcode_name = "<unknown>"; break; |
| 510 | case OP_NULL: opcode_name = "OP_NULL"; break; |
| 511 | case BINOP_ADD: opcode_name = "BINOP_ADD"; break; |
| 512 | case BINOP_SUB: opcode_name = "BINOP_SUB"; break; |
| 513 | case BINOP_MUL: opcode_name = "BINOP_MUL"; break; |
| 514 | case BINOP_DIV: opcode_name = "BINOP_DIV"; break; |
| 515 | case BINOP_REM: opcode_name = "BINOP_REM"; break; |
| 516 | case BINOP_MOD: opcode_name = "BINOP_MOD"; break; |
| 517 | case BINOP_LSH: opcode_name = "BINOP_LSH"; break; |
| 518 | case BINOP_RSH: opcode_name = "BINOP_RSH"; break; |
| 519 | case BINOP_LOGICAL_AND: opcode_name = "BINOP_LOGICAL_AND"; break; |
| 520 | case BINOP_LOGICAL_OR: opcode_name = "BINOP_LOGICAL_OR"; break; |
| 521 | case BINOP_BITWISE_AND: opcode_name = "BINOP_BITWISE_AND"; break; |
| 522 | case BINOP_BITWISE_IOR: opcode_name = "BINOP_BITWISE_IOR"; break; |
| 523 | case BINOP_BITWISE_XOR: opcode_name = "BINOP_BITWISE_XOR"; break; |
| 524 | case BINOP_EQUAL: opcode_name = "BINOP_EQUAL"; break; |
| 525 | case BINOP_NOTEQUAL: opcode_name = "BINOP_NOTEQUAL"; break; |
| 526 | case BINOP_LESS: opcode_name = "BINOP_LESS"; break; |
| 527 | case BINOP_GTR: opcode_name = "BINOP_GTR"; break; |
| 528 | case BINOP_LEQ: opcode_name = "BINOP_LEQ"; break; |
| 529 | case BINOP_GEQ: opcode_name = "BINOP_GEQ"; break; |
| 530 | case BINOP_REPEAT: opcode_name = "BINOP_REPEAT"; break; |
| 531 | case BINOP_ASSIGN: opcode_name = "BINOP_ASSIGN"; break; |
| 532 | case BINOP_COMMA: opcode_name = "BINOP_COMMA"; break; |
| 533 | case BINOP_SUBSCRIPT: opcode_name = "BINOP_SUBSCRIPT"; break; |
| 534 | case MULTI_SUBSCRIPT: opcode_name = "MULTI_SUBSCRIPT"; break; |
| 535 | case BINOP_EXP: opcode_name = "BINOP_EXP"; break; |
| 536 | case BINOP_MIN: opcode_name = "BINOP_MIN"; break; |
| 537 | case BINOP_MAX: opcode_name = "BINOP_MAX"; break; |
| 538 | case BINOP_SCOPE: opcode_name = "BINOP_SCOPE"; break; |
| 539 | case STRUCTOP_MEMBER: opcode_name = "STRUCTOP_MEMBER"; break; |
| 540 | case STRUCTOP_MPTR: opcode_name = "STRUCTOP_MPTR"; break; |
| 541 | case BINOP_INTDIV: opcode_name = "BINOP_INTDIV"; break; |
| 542 | case BINOP_ASSIGN_MODIFY: opcode_name = "BINOP_ASSIGN_MODIFY"; break; |
| 543 | case BINOP_VAL: opcode_name = "BINOP_VAL"; break; |
| 544 | case BINOP_INCL: opcode_name = "BINOP_INCL"; break; |
| 545 | case BINOP_EXCL: opcode_name = "BINOP_EXCL"; break; |
| 546 | case BINOP_CONCAT: opcode_name = "BINOP_CONCAT"; break; |
| 547 | case BINOP_END: opcode_name = "BINOP_END"; break; |
| 548 | case TERNOP_COND: opcode_name = "TERNOP_COND"; break; |
| 549 | case OP_LONG: opcode_name = "OP_LONG"; break; |
| 550 | case OP_DOUBLE: opcode_name = "OP_DOUBLE"; break; |
| 551 | case OP_VAR_VALUE: opcode_name = "OP_VAR_VALUE"; break; |
| 552 | case OP_LAST: opcode_name = "OP_LAST"; break; |
| 553 | case OP_REGISTER: opcode_name = "OP_REGISTER"; break; |
| 554 | case OP_INTERNALVAR: opcode_name = "OP_INTERNALVAR"; break; |
| 555 | case OP_FUNCALL: opcode_name = "OP_FUNCALL"; break; |
| 556 | case OP_STRING: opcode_name = "OP_STRING"; break; |
| 557 | case OP_BITSTRING: opcode_name = "OP_BITSTRING"; break; |
| 558 | case OP_ARRAY: opcode_name = "OP_ARRAY"; break; |
| 559 | case UNOP_CAST: opcode_name = "UNOP_CAST"; break; |
| 560 | case UNOP_MEMVAL: opcode_name = "UNOP_MEMVAL"; break; |
| 561 | case UNOP_NEG: opcode_name = "UNOP_NEG"; break; |
| 562 | case UNOP_LOGICAL_NOT: opcode_name = "UNOP_LOGICAL_NOT"; break; |
| 563 | case UNOP_COMPLEMENT: opcode_name = "UNOP_COMPLEMENT"; break; |
| 564 | case UNOP_IND: opcode_name = "UNOP_IND"; break; |
| 565 | case UNOP_ADDR: opcode_name = "UNOP_ADDR"; break; |
| 566 | case UNOP_PREINCREMENT: opcode_name = "UNOP_PREINCREMENT"; break; |
| 567 | case UNOP_POSTINCREMENT: opcode_name = "UNOP_POSTINCREMENT"; break; |
| 568 | case UNOP_PREDECREMENT: opcode_name = "UNOP_PREDECREMENT"; break; |
| 569 | case UNOP_POSTDECREMENT: opcode_name = "UNOP_POSTDECREMENT"; break; |
| 570 | case UNOP_SIZEOF: opcode_name = "UNOP_SIZEOF"; break; |
| 571 | case UNOP_PLUS: opcode_name = "UNOP_PLUS"; break; |
| 572 | case UNOP_CAP: opcode_name = "UNOP_CAP"; break; |
| 573 | case UNOP_CHR: opcode_name = "UNOP_CHR"; break; |
| 574 | case UNOP_ORD: opcode_name = "UNOP_ORD"; break; |
| 575 | case UNOP_ABS: opcode_name = "UNOP_ABS"; break; |
| 576 | case UNOP_FLOAT: opcode_name = "UNOP_FLOAT"; break; |
| 577 | case UNOP_HIGH: opcode_name = "UNOP_HIGH"; break; |
| 578 | case UNOP_MAX: opcode_name = "UNOP_MAX"; break; |
| 579 | case UNOP_MIN: opcode_name = "UNOP_MIN"; break; |
| 580 | case UNOP_ODD: opcode_name = "UNOP_ODD"; break; |
| 581 | case UNOP_TRUNC: opcode_name = "UNOP_TRUNC"; break; |
| 582 | case OP_BOOL: opcode_name = "OP_BOOL"; break; |
| 583 | case OP_M2_STRING: opcode_name = "OP_M2_STRING"; break; |
| 584 | case STRUCTOP_STRUCT: opcode_name = "STRUCTOP_STRUCT"; break; |
| 585 | case STRUCTOP_PTR: opcode_name = "STRUCTOP_PTR"; break; |
| 586 | case OP_THIS: opcode_name = "OP_THIS"; break; |
| 587 | case OP_SCOPE: opcode_name = "OP_SCOPE"; break; |
| 588 | case OP_TYPE: opcode_name = "OP_TYPE"; break; |
| 589 | } |
| 590 | fprintf_filtered (stream, "%20s ", opcode_name); |
| 591 | fprintf_filtered (stream, |
| 592 | #if defined (LONG_LONG) |
| 593 | "%ll16x ", |
| 594 | #else |
| 595 | "%l16x ", |
| 596 | #endif |
| 597 | exp -> elts[elt].longconst); |
| 598 | |
| 599 | for (eltscan = (char *) &exp->elts[elt], |
| 600 | eltsize = sizeof (union exp_element) ; |
| 601 | eltsize-- > 0; |
| 602 | eltscan++) |
| 603 | { |
| 604 | fprintf_filtered (stream, "%c", |
| 605 | isprint (*eltscan) ? (*eltscan & 0xFF) : '.'); |
| 606 | } |
| 607 | fprintf_filtered (stream, "\n"); |
| 608 | } |
| 609 | } |
| 610 | |
| 611 | #endif /* DEBUG_EXPRESSIONS */ |