home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 9 / FreshFishVol9-CD2.bin / bbs / gnu / gdb-4.14-src.lha / gdb-4.14 / gdb / expprint.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-02-02  |  21.3 KB  |  678 lines

  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 *, GDB_FILE *, enum precedence));
  32.  
  33. static void
  34. print_simple_m2_func PARAMS ((char *, struct expression *, int *, GDB_FILE *));
  35.  
  36. void
  37. print_expression (exp, stream)
  38.      struct expression *exp;
  39.      GDB_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.      GDB_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 = PREC_NULL;
  65.   /* Set to 1 for a right-associative operator.  */
  66.   int assoc = 0;
  67.   value_ptr val;
  68.   char *tempstr = NULL;
  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.       {
  103.     struct block *b;
  104.     (*pos) += 3;
  105.     b = exp->elts[pc + 1].block;
  106.     if (b != NULL
  107.         && BLOCK_FUNCTION (b) != NULL
  108.         && SYMBOL_SOURCE_NAME (BLOCK_FUNCTION (b)) != NULL)
  109.       {
  110.         fputs_filtered (SYMBOL_SOURCE_NAME (BLOCK_FUNCTION (b)), stream);
  111.         fputs_filtered ("::", stream);
  112.       }
  113.     fputs_filtered (SYMBOL_SOURCE_NAME (exp->elts[pc + 2].symbol), stream);
  114.       }
  115.       return;
  116.  
  117.     case OP_LAST:
  118.       (*pos) += 2;
  119.       fprintf_filtered (stream, "$%d",
  120.             longest_to_int (exp->elts[pc + 1].longconst));
  121.       return;
  122.  
  123.     case OP_REGISTER:
  124.       (*pos) += 2;
  125.       fprintf_filtered (stream, "$%s",
  126.            reg_names[longest_to_int (exp->elts[pc + 1].longconst)]);
  127.       return;
  128.  
  129.     case OP_BOOL:
  130.       (*pos) += 2;
  131.       fprintf_filtered (stream, "%s",
  132.             longest_to_int (exp->elts[pc + 1].longconst)
  133.             ? "TRUE" : "FALSE");
  134.       return;
  135.  
  136.     case OP_INTERNALVAR:
  137.       (*pos) += 2;
  138.       fprintf_filtered (stream, "$%s",
  139.            internalvar_name (exp->elts[pc + 1].internalvar));
  140.       return;
  141.  
  142.     case OP_FUNCALL:
  143.       (*pos) += 2;
  144.       nargs = longest_to_int (exp->elts[pc + 1].longconst);
  145.       print_subexp (exp, pos, stream, PREC_SUFFIX);
  146.       fputs_filtered (" (", stream);
  147.       for (tem = 0; tem < nargs; tem++)
  148.     {
  149.       if (tem != 0)
  150.         fputs_filtered (", ", stream);
  151.       print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
  152.     }
  153.       fputs_filtered (")", stream);
  154.       return;
  155.  
  156.     case OP_STRING:
  157.       nargs = longest_to_int (exp -> elts[pc + 1].longconst);
  158.       (*pos) += 3 + BYTES_TO_EXP_ELEM (nargs + 1);
  159.       /* LA_PRINT_STRING will print using the current repeat count threshold.
  160.      If necessary, we can temporarily set it to zero, or pass it as an
  161.      additional parameter to LA_PRINT_STRING.  -fnf */
  162.       LA_PRINT_STRING (stream, &exp->elts[pc + 2].string, nargs, 0);
  163.       return;
  164.  
  165.     case OP_BITSTRING:
  166.       nargs = longest_to_int (exp -> elts[pc + 1].longconst);
  167.       (*pos)
  168.     += 3 + BYTES_TO_EXP_ELEM ((nargs + HOST_CHAR_BIT - 1) / HOST_CHAR_BIT);
  169.       fprintf (stream, "B'<unimplemented>'");
  170.       return;
  171.  
  172.     case OP_ARRAY:
  173.       (*pos) += 3;
  174.       nargs = longest_to_int (exp->elts[pc + 2].longconst);
  175.       nargs -= longest_to_int (exp->elts[pc + 1].longconst);
  176.       nargs++;
  177.       tem = 0;
  178.       if (exp->elts[pc + 4].opcode == OP_LONG
  179.       && exp->elts[pc + 5].type == builtin_type_char
  180.       && exp->language_defn->la_language == language_c)
  181.     {
  182.       /* Attempt to print C character arrays using string syntax.
  183.          Walk through the args, picking up one character from each
  184.          of the OP_LONG expression elements.  If any array element
  185.          does not match our expection of what we should find for
  186.          a simple string, revert back to array printing.  Note that
  187.          the last expression element is an explicit null terminator
  188.          byte, which doesn't get printed. */
  189.       tempstr = alloca (nargs);
  190.       pc += 4;
  191.       while (tem < nargs)
  192.         {
  193.           if (exp->elts[pc].opcode != OP_LONG
  194.           || exp->elts[pc + 1].type != builtin_type_char)
  195.         {
  196.           /* Not a simple array of char, use regular array printing. */
  197.           tem = 0;
  198.           break;
  199.         }
  200.           else
  201.         {
  202.           tempstr[tem++] =
  203.             longest_to_int (exp->elts[pc + 2].longconst);
  204.           pc += 4;
  205.         }
  206.         }
  207.     }
  208.       if (tem > 0)
  209.     {
  210.       LA_PRINT_STRING (stream, tempstr, nargs - 1, 0);
  211.       (*pos) = pc;
  212.     }
  213.       else
  214.     {
  215.       int is_chill = exp->language_defn->la_language == language_chill;
  216.       fputs_filtered (is_chill ? " [" : " {", stream);
  217.       for (tem = 0; tem < nargs; tem++)
  218.         {
  219.           if (tem != 0)
  220.         {
  221.           fputs_filtered (", ", stream);
  222.         }
  223.           print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
  224.         }
  225.       fputs_filtered (is_chill ? "]" : "}", stream);
  226.     }
  227.       return;
  228.  
  229.     case OP_LABELED:
  230.       tem = longest_to_int (exp->elts[pc + 1].longconst);
  231.       (*pos) += 3 + BYTES_TO_EXP_ELEM (tem + 1);
  232.  
  233.       if (exp->language_defn->la_language == language_chill)
  234.     {
  235.       fputs_filtered (".", stream);
  236.       fputs_filtered (&exp->elts[pc + 2].string, stream);
  237.       fputs_filtered (exp->elts[*pos].opcode == OP_LABELED ? ", "
  238.               : ": ",
  239.               stream);
  240.     }
  241.       else
  242.     {
  243.       /* Gcc support both these syntaxes.  Unsure which is preferred.  */
  244. #if 1
  245.       fputs_filtered (&exp->elts[pc + 2].string, stream);
  246.       fputs_filtered (": ", stream);
  247. #else
  248.       fputs_filtered (".", stream);
  249.       fputs_filtered (&exp->elts[pc + 2].string, stream);
  250.       fputs_filtered ("=", stream);
  251. #endif
  252.     }
  253.       print_subexp (exp, pos, stream, PREC_SUFFIX);
  254.       return;
  255.  
  256.     case TERNOP_COND:
  257.       if ((int) prec > (int) PREC_COMMA)
  258.     fputs_filtered ("(", stream);
  259.       /* Print the subexpressions, forcing parentheses
  260.      around any binary operations within them.
  261.      This is more parentheses than are strictly necessary,
  262.      but it looks clearer.  */
  263.       print_subexp (exp, pos, stream, PREC_HYPER);
  264.       fputs_filtered (" ? ", stream);
  265.       print_subexp (exp, pos, stream, PREC_HYPER);
  266.       fputs_filtered (" : ", stream);
  267.       print_subexp (exp, pos, stream, PREC_HYPER);
  268.       if ((int) prec > (int) PREC_COMMA)
  269.     fputs_filtered (")", stream);
  270.       return;
  271.  
  272.     case TERNOP_SLICE:
  273.     case TERNOP_SLICE_COUNT:
  274.       print_subexp (exp, pos, stream, PREC_SUFFIX);
  275.       fputs_filtered ("(", stream);
  276.       print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
  277.       fputs_filtered (opcode == TERNOP_SLICE ? " : " : " UP ", stream);
  278.       print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
  279.       fputs_filtered (")", stream);
  280.       return;
  281.  
  282.     case STRUCTOP_STRUCT:
  283.       tem = longest_to_int (exp->elts[pc + 1].longconst);
  284.       (*pos) += 3 + BYTES_TO_EXP_ELEM (tem + 1);
  285.       print_subexp (exp, pos, stream, PREC_SUFFIX);
  286.       fputs_filtered (".", stream);
  287.       fputs_filtered (&exp->elts[pc + 2].string, stream);
  288.       return;
  289.  
  290.     /* Will not occur for Modula-2 */
  291.     case STRUCTOP_PTR:
  292.       tem = longest_to_int (exp->elts[pc + 1].longconst);
  293.       (*pos) += 3 + BYTES_TO_EXP_ELEM (tem + 1);
  294.       print_subexp (exp, pos, stream, PREC_SUFFIX);
  295.       fputs_filtered ("->", stream);
  296.       fputs_filtered (&exp->elts[pc + 2].string, stream);
  297.       return;
  298.  
  299.     case BINOP_SUBSCRIPT:
  300.       print_subexp (exp, pos, stream, PREC_SUFFIX);
  301.       fputs_filtered ("[", stream);
  302.       print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
  303.       fputs_filtered ("]", stream);
  304.       return;
  305.  
  306.     case UNOP_POSTINCREMENT:
  307.       print_subexp (exp, pos, stream, PREC_SUFFIX);
  308.       fputs_filtered ("++", stream);
  309.       return;
  310.  
  311.     case UNOP_POSTDECREMENT:
  312.       print_subexp (exp, pos, stream, PREC_SUFFIX);
  313.       fputs_filtered ("--", stream);
  314.       return;
  315.  
  316.     case UNOP_CAST:
  317.       (*pos) += 2;
  318.       if ((int) prec > (int) PREC_PREFIX)
  319.         fputs_filtered ("(", stream);
  320.       fputs_filtered ("(", stream);
  321.       type_print (exp->elts[pc + 1].type, "", stream, 0);
  322.       fputs_filtered (") ", stream);
  323.       print_subexp (exp, pos, stream, PREC_PREFIX);
  324.       if ((int) prec > (int) PREC_PREFIX)
  325.         fputs_filtered (")", stream);
  326.       return;
  327.  
  328.     case UNOP_MEMVAL:
  329.       (*pos) += 2;
  330.       if ((int) prec > (int) PREC_PREFIX)
  331.         fputs_filtered ("(", stream);
  332.       if (exp->elts[pc + 1].type->code == TYPE_CODE_FUNC &&
  333.       exp->elts[pc + 3].opcode == OP_LONG) {
  334.     /* We have a minimal symbol fn, probably.  It's encoded
  335.        as a UNOP_MEMVAL (function-type) of an OP_LONG (int, address).
  336.        Swallow the OP_LONG (including both its opcodes); ignore
  337.        its type; print the value in the type of the MEMVAL.  */
  338.     (*pos) += 4;
  339.     val = value_at_lazy (exp->elts[pc + 1].type,
  340.                  (CORE_ADDR) exp->elts[pc + 5].longconst);
  341.     value_print (val, stream, 0, Val_no_prettyprint);
  342.       } else {
  343.     fputs_filtered ("{", stream);
  344.     type_print (exp->elts[pc + 1].type, "", stream, 0);
  345.     fputs_filtered ("} ", stream);
  346.         print_subexp (exp, pos, stream, PREC_PREFIX);
  347.       }
  348.       if ((int) prec > (int) PREC_PREFIX)
  349.         fputs_filtered (")", stream);
  350.       return;
  351.  
  352.     case BINOP_ASSIGN_MODIFY:
  353.       opcode = exp->elts[pc + 1].opcode;
  354.       (*pos) += 2;
  355.       myprec = PREC_ASSIGN;
  356.       assoc = 1;
  357.       assign_modify = 1;
  358.       op_str = "???";
  359.       for (tem = 0; op_print_tab[tem].opcode != OP_NULL; tem++)
  360.     if (op_print_tab[tem].opcode == opcode)
  361.       {
  362.         op_str = op_print_tab[tem].string;
  363.         break;
  364.       }
  365.       if (op_print_tab[tem].opcode != opcode)
  366.     /* Not found; don't try to keep going because we don't know how
  367.        to interpret further elements.  */
  368.     error ("Invalid expression");
  369.       break;
  370.  
  371.     /* C++ ops */
  372.  
  373.     case OP_THIS:
  374.       ++(*pos);
  375.       fputs_filtered ("this", stream);
  376.       return;
  377.  
  378.     /* Modula-2 ops */
  379.  
  380.     case MULTI_SUBSCRIPT:
  381.       (*pos) += 2;
  382.       nargs = longest_to_int (exp->elts[pc + 1].longconst);
  383.       print_subexp (exp, pos, stream, PREC_SUFFIX);
  384.       fprintf_unfiltered (stream, " [");
  385.       for (tem = 0; tem < nargs; tem++)
  386.     {
  387.       if (tem != 0)
  388.         fprintf_unfiltered (stream, ", ");
  389.       print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
  390.     }
  391.       fprintf_unfiltered (stream, "]");
  392.       return;
  393.  
  394.     case BINOP_VAL:
  395.       (*pos)+=2;
  396.       fprintf_unfiltered(stream,"VAL(");
  397.       type_print(exp->elts[pc+1].type,"",stream,0);
  398.       fprintf_unfiltered(stream,",");
  399.       print_subexp(exp,pos,stream,PREC_PREFIX);
  400.       fprintf_unfiltered(stream,")");
  401.       return;
  402.  
  403.     case UNOP_CAP:
  404.       print_simple_m2_func("CAP",exp,pos,stream);
  405.       return;
  406.  
  407.     case UNOP_CHR:
  408.       print_simple_m2_func("CHR",exp,pos,stream);
  409.       return;
  410.  
  411.     case UNOP_ORD:
  412.       print_simple_m2_func("ORD",exp,pos,stream);
  413.       return;
  414.       
  415.     case UNOP_ABS:
  416.       print_simple_m2_func("ABS",exp,pos,stream);
  417.       return;
  418.  
  419.     case UNOP_FLOAT:
  420.       print_simple_m2_func("FLOAT",exp,pos,stream);
  421.       return;
  422.  
  423.     case UNOP_HIGH:
  424.       print_simple_m2_func("HIGH",exp,pos,stream);
  425.       return;
  426.  
  427.     case UNOP_MAX:
  428.       print_simple_m2_func("MAX",exp,pos,stream);
  429.       return;
  430.  
  431.     case UNOP_MIN:
  432.       print_simple_m2_func("MIN",exp,pos,stream);
  433.       return;
  434.  
  435.     case UNOP_ODD:
  436.       print_simple_m2_func("ODD",exp,pos,stream);
  437.       return;
  438.  
  439.     case UNOP_TRUNC:
  440.       print_simple_m2_func("TRUNC",exp,pos,stream);
  441.       return;
  442.       
  443.     case BINOP_INCL:
  444.     case BINOP_EXCL:
  445.       error("print_subexp:  Not implemented.");
  446.  
  447.     /* Default ops */
  448.  
  449.     default:
  450.       op_str = "???";
  451.       for (tem = 0; op_print_tab[tem].opcode != OP_NULL; tem++)
  452.     if (op_print_tab[tem].opcode == opcode)
  453.       {
  454.         op_str = op_print_tab[tem].string;
  455.         myprec = op_print_tab[tem].precedence;
  456.         assoc = op_print_tab[tem].right_assoc;
  457.         break;
  458.       }
  459.       if (op_print_tab[tem].opcode != opcode)
  460.     /* Not found; don't try to keep going because we don't know how
  461.        to interpret further elements.  For example, this happens
  462.        if opcode is OP_TYPE.  */
  463.     error ("Invalid expression");
  464.    }
  465.  
  466.   if ((int) myprec < (int) prec)
  467.     fputs_filtered ("(", stream);
  468.   if ((int) opcode > (int) BINOP_END)
  469.     {
  470.       if (assoc)
  471.     {
  472.       /* Unary postfix operator.  */
  473.       print_subexp (exp, pos, stream, PREC_SUFFIX);
  474.       fputs_filtered (op_str, stream);
  475.     }
  476.       else
  477.     {
  478.       /* Unary prefix operator.  */
  479.       fputs_filtered (op_str, stream);
  480.       print_subexp (exp, pos, stream, PREC_PREFIX);
  481.     }
  482.     }
  483.   else
  484.     {
  485.       /* Binary operator.  */
  486.       /* Print left operand.
  487.      If operator is right-associative,
  488.      increment precedence for this operand.  */
  489.       print_subexp (exp, pos, stream,
  490.             (enum precedence) ((int) myprec + assoc));
  491.       /* Print the operator itself.  */
  492.       if (assign_modify)
  493.     fprintf_filtered (stream, " %s= ", op_str);
  494.       else if (op_str[0] == ',')
  495.     fprintf_filtered (stream, "%s ", op_str);
  496.       else
  497.     fprintf_filtered (stream, " %s ", op_str);
  498.       /* Print right operand.
  499.      If operator is left-associative,
  500.      increment precedence for this operand.  */
  501.       print_subexp (exp, pos, stream,
  502.             (enum precedence) ((int) myprec + !assoc));
  503.     }
  504.  
  505.   if ((int) myprec < (int) prec)
  506.     fputs_filtered (")", stream);
  507. }
  508.  
  509. /* Print out something of the form <s>(<arg>).
  510.    This is used to print out some builtin Modula-2
  511.    functions.
  512.    FIXME:  There is probably some way to get the precedence
  513.    rules to do this (print a unary operand with parens around it).  */
  514. static void
  515. print_simple_m2_func(s,exp,pos,stream)
  516.    char *s;
  517.    register struct expression *exp;
  518.    register int *pos;
  519.    GDB_FILE *stream;
  520. {
  521.    fprintf_unfiltered(stream,"%s(",s);
  522.    print_subexp(exp,pos,stream,PREC_PREFIX);
  523.    fprintf_unfiltered(stream,")");
  524. }
  525.    
  526. /* Return the operator corresponding to opcode OP as
  527.    a string.   NULL indicates that the opcode was not found in the
  528.    current language table.  */
  529. char *
  530. op_string(op)
  531.    enum exp_opcode op;
  532. {
  533.   int tem;
  534.   register const struct op_print *op_print_tab;
  535.  
  536.   op_print_tab = current_language->la_op_print_tab;
  537.   for (tem = 0; op_print_tab[tem].opcode != OP_NULL; tem++)
  538.     if (op_print_tab[tem].opcode == op)
  539.       return op_print_tab[tem].string;
  540.   return NULL;
  541. }
  542.  
  543. #ifdef DEBUG_EXPRESSIONS
  544.  
  545. /* Support for dumping the raw data from expressions in a human readable
  546.    form.  */
  547.  
  548. void
  549. dump_expression (exp, stream, note)
  550.      struct expression *exp;
  551.      GDB_FILE *stream;
  552.      char *note;
  553. {
  554.   int elt;
  555.   char *opcode_name;
  556.   char *eltscan;
  557.   int eltsize;
  558.  
  559.   fprintf_filtered (stream, "Dump of expression @ ");
  560.   gdb_print_address (exp, stream);
  561.   fprintf_filtered (stream, ", %s:\n", note);
  562.   fprintf_filtered (stream, "\tLanguage %s, %d elements, %d bytes each.\n",
  563.             exp->language_defn->la_name, exp -> nelts,
  564.             sizeof (union exp_element));
  565.   fprintf_filtered (stream, "\t%5s  %20s  %16s  %s\n", "Index", "Opcode",
  566.             "Hex Value", "String Value");
  567.   for (elt = 0; elt < exp -> nelts; elt++)
  568.     {
  569.       fprintf_filtered (stream, "\t%5d  ", elt);
  570.       switch (exp -> elts[elt].opcode)
  571.     {
  572.       default: opcode_name = "<unknown>"; break;
  573.       case OP_NULL: opcode_name = "OP_NULL"; break;
  574.       case BINOP_ADD: opcode_name = "BINOP_ADD"; break;
  575.       case BINOP_SUB: opcode_name = "BINOP_SUB"; break;
  576.       case BINOP_MUL: opcode_name = "BINOP_MUL"; break;
  577.       case BINOP_DIV: opcode_name = "BINOP_DIV"; break;
  578.       case BINOP_REM: opcode_name = "BINOP_REM"; break;
  579.       case BINOP_MOD: opcode_name = "BINOP_MOD"; break;
  580.       case BINOP_LSH: opcode_name = "BINOP_LSH"; break;
  581.       case BINOP_RSH: opcode_name = "BINOP_RSH"; break;
  582.       case BINOP_LOGICAL_AND: opcode_name = "BINOP_LOGICAL_AND"; break;
  583.       case BINOP_LOGICAL_OR: opcode_name = "BINOP_LOGICAL_OR"; break;
  584.       case BINOP_BITWISE_AND: opcode_name = "BINOP_BITWISE_AND"; break;
  585.       case BINOP_BITWISE_IOR: opcode_name = "BINOP_BITWISE_IOR"; break;
  586.       case BINOP_BITWISE_XOR: opcode_name = "BINOP_BITWISE_XOR"; break;
  587.       case BINOP_EQUAL: opcode_name = "BINOP_EQUAL"; break;
  588.       case BINOP_NOTEQUAL: opcode_name = "BINOP_NOTEQUAL"; break;
  589.       case BINOP_LESS: opcode_name = "BINOP_LESS"; break;
  590.       case BINOP_GTR: opcode_name = "BINOP_GTR"; break;
  591.       case BINOP_LEQ: opcode_name = "BINOP_LEQ"; break;
  592.       case BINOP_GEQ: opcode_name = "BINOP_GEQ"; break;
  593.       case BINOP_REPEAT: opcode_name = "BINOP_REPEAT"; break;
  594.       case BINOP_ASSIGN: opcode_name = "BINOP_ASSIGN"; break;
  595.       case BINOP_COMMA: opcode_name = "BINOP_COMMA"; break;
  596.       case BINOP_SUBSCRIPT: opcode_name = "BINOP_SUBSCRIPT"; break;
  597.       case MULTI_SUBSCRIPT: opcode_name = "MULTI_SUBSCRIPT"; break;
  598.       case BINOP_EXP: opcode_name = "BINOP_EXP"; break;
  599.       case BINOP_MIN: opcode_name = "BINOP_MIN"; break;
  600.       case BINOP_MAX: opcode_name = "BINOP_MAX"; break;
  601.       case BINOP_SCOPE: opcode_name = "BINOP_SCOPE"; break;
  602.       case STRUCTOP_MEMBER: opcode_name = "STRUCTOP_MEMBER"; break;
  603.       case STRUCTOP_MPTR: opcode_name = "STRUCTOP_MPTR"; break;
  604.       case BINOP_INTDIV: opcode_name = "BINOP_INTDIV"; break;
  605.       case BINOP_ASSIGN_MODIFY: opcode_name = "BINOP_ASSIGN_MODIFY"; break;
  606.       case BINOP_VAL: opcode_name = "BINOP_VAL"; break;
  607.       case BINOP_INCL: opcode_name = "BINOP_INCL"; break;
  608.       case BINOP_EXCL: opcode_name = "BINOP_EXCL"; break;
  609.       case BINOP_CONCAT: opcode_name = "BINOP_CONCAT"; break;
  610.       case BINOP_END: opcode_name = "BINOP_END"; break;
  611.       case TERNOP_COND: opcode_name = "TERNOP_COND"; break;
  612.       case TERNOP_SLICE: opcode_name = "TERNOP_SLICE"; break;
  613.       case TERNOP_SLICE_COUNT: opcode_name = "TERNOP_SLICE_COUNT"; break;
  614.       case OP_LONG: opcode_name = "OP_LONG"; break;
  615.       case OP_DOUBLE: opcode_name = "OP_DOUBLE"; break;
  616.       case OP_VAR_VALUE: opcode_name = "OP_VAR_VALUE"; break;
  617.       case OP_LAST: opcode_name = "OP_LAST"; break;
  618.       case OP_REGISTER: opcode_name = "OP_REGISTER"; break;
  619.       case OP_INTERNALVAR: opcode_name = "OP_INTERNALVAR"; break;
  620.       case OP_FUNCALL: opcode_name = "OP_FUNCALL"; break;
  621.       case OP_STRING: opcode_name = "OP_STRING"; break;
  622.       case OP_BITSTRING: opcode_name = "OP_BITSTRING"; break;
  623.       case OP_ARRAY: opcode_name = "OP_ARRAY"; break;
  624.       case UNOP_CAST: opcode_name = "UNOP_CAST"; break;
  625.       case UNOP_MEMVAL: opcode_name = "UNOP_MEMVAL"; break;
  626.       case UNOP_NEG: opcode_name = "UNOP_NEG"; break;
  627.       case UNOP_LOGICAL_NOT: opcode_name = "UNOP_LOGICAL_NOT"; break;
  628.       case UNOP_COMPLEMENT: opcode_name = "UNOP_COMPLEMENT"; break;
  629.       case UNOP_IND: opcode_name = "UNOP_IND"; break;
  630.       case UNOP_ADDR: opcode_name = "UNOP_ADDR"; break;
  631.       case UNOP_PREINCREMENT: opcode_name = "UNOP_PREINCREMENT"; break;
  632.       case UNOP_POSTINCREMENT: opcode_name = "UNOP_POSTINCREMENT"; break;
  633.       case UNOP_PREDECREMENT: opcode_name = "UNOP_PREDECREMENT"; break;
  634.       case UNOP_POSTDECREMENT: opcode_name = "UNOP_POSTDECREMENT"; break;
  635.       case UNOP_SIZEOF: opcode_name = "UNOP_SIZEOF"; break;
  636.       case UNOP_PLUS: opcode_name = "UNOP_PLUS"; break;
  637.       case UNOP_CAP: opcode_name = "UNOP_CAP"; break;
  638.       case UNOP_CHR: opcode_name = "UNOP_CHR"; break;
  639.       case UNOP_ORD: opcode_name = "UNOP_ORD"; break;
  640.       case UNOP_ABS: opcode_name = "UNOP_ABS"; break;
  641.       case UNOP_FLOAT: opcode_name = "UNOP_FLOAT"; break;
  642.       case UNOP_HIGH: opcode_name = "UNOP_HIGH"; break;
  643.       case UNOP_MAX: opcode_name = "UNOP_MAX"; break;
  644.       case UNOP_MIN: opcode_name = "UNOP_MIN"; break;
  645.       case UNOP_ODD: opcode_name = "UNOP_ODD"; break;
  646.       case UNOP_TRUNC: opcode_name = "UNOP_TRUNC"; break;
  647.       case OP_BOOL: opcode_name = "OP_BOOL"; break;
  648.       case OP_M2_STRING: opcode_name = "OP_M2_STRING"; break;
  649.       case STRUCTOP_STRUCT: opcode_name = "STRUCTOP_STRUCT"; break;
  650.       case STRUCTOP_PTR: opcode_name = "STRUCTOP_PTR"; break;
  651.       case OP_THIS: opcode_name = "OP_THIS"; break;
  652.       case OP_SCOPE: opcode_name = "OP_SCOPE"; break;
  653.       case OP_TYPE: opcode_name = "OP_TYPE"; break;
  654.       case OP_LABELED: opcode_name = "OP_LABELED"; break;
  655.     }
  656.       fprintf_filtered (stream, "%20s  ", opcode_name);
  657.       fprintf_filtered (stream,
  658. #if defined (PRINTF_HAS_LONG_LONG)
  659.             "%ll16x  ",
  660. #else
  661.             "%l16x  ",
  662. #endif
  663.             exp -> elts[elt].longconst);
  664.  
  665.       for (eltscan = (char *) &exp->elts[elt],
  666.          eltsize = sizeof (union exp_element) ;
  667.        eltsize-- > 0;
  668.        eltscan++)
  669.     {
  670.       fprintf_filtered (stream, "%c",
  671.                 isprint (*eltscan) ? (*eltscan & 0xFF) : '.');
  672.     }
  673.       fprintf_filtered (stream, "\n");
  674.     }
  675. }
  676.  
  677. #endif    /* DEBUG_EXPRESSIONS */
  678.