gdb: fix vfork with multiple threads
[deliverable/binutils-gdb.git] / gdb / m2-lang.c
index 5748b60d59cb24e6bda89964f1f4bf8e742c35e6..911d67d86721d1d665087c789fa482177077e6e6 100644 (file)
 #include "c-lang.h"
 #include "valprint.h"
 #include "gdbarch.h"
+#include "m2-exp.h"
 
 /* A helper function for UNOP_HIGH.  */
 
-static struct value *
+struct value *
 eval_op_m2_high (struct type *expect_type, struct expression *exp,
                 enum noside noside,
                 struct value *arg1)
 {
-  if (noside == EVAL_SKIP || noside == EVAL_AVOID_SIDE_EFFECTS)
+  if (noside == EVAL_AVOID_SIDE_EFFECTS)
     return arg1;
   else
     {
@@ -49,7 +50,7 @@ eval_op_m2_high (struct type *expect_type, struct expression *exp,
 
          type = type->field (1).type ();
          /* i18n: Do not translate the "_m2_high" part!  */
-         arg1 = value_struct_elt (&temp, NULL, "_m2_high", NULL,
+         arg1 = value_struct_elt (&temp, {}, "_m2_high", NULL,
                                   _("unbounded structure "
                                     "missing _m2_high field"));
 
@@ -62,13 +63,11 @@ eval_op_m2_high (struct type *expect_type, struct expression *exp,
 
 /* A helper function for BINOP_SUBSCRIPT.  */
 
-static struct value *
+struct value *
 eval_op_m2_subscript (struct type *expect_type, struct expression *exp,
                      enum noside noside,
                      struct value *arg1, struct value *arg2)
 {
-  if (noside == EVAL_SKIP)
-    return eval_skip_value (exp);
   /* If the user attempts to subscript something that is not an
      array or pointer type (like a plain int variable for example),
      then report this as an error.  */
@@ -84,7 +83,7 @@ eval_op_m2_subscript (struct type *expect_type, struct expression *exp,
        error (_("internal error: unbounded "
                 "array structure is unknown"));
       /* i18n: Do not translate the "_m2_contents" part!  */
-      arg1 = value_struct_elt (&temp, NULL, "_m2_contents", NULL,
+      arg1 = value_struct_elt (&temp, {}, "_m2_contents", NULL,
                               _("unbounded structure "
                                 "missing _m2_contents field"));
          
@@ -110,79 +109,8 @@ eval_op_m2_subscript (struct type *expect_type, struct expression *exp,
     return value_subscript (arg1, value_as_long (arg2));
 }
 
-static struct value *
-evaluate_subexp_modula2 (struct type *expect_type, struct expression *exp,
-                        int *pos, enum noside noside)
-{
-  enum exp_opcode op = exp->elts[*pos].opcode;
-  struct value *arg1;
-  struct value *arg2;
-
-  switch (op)
-    {
-    case UNOP_HIGH:
-      (*pos)++;
-      arg1 = evaluate_subexp_with_coercion (exp, pos, noside);
-      return eval_op_m2_high (expect_type, exp, noside, arg1);
-
-    case BINOP_SUBSCRIPT:
-      (*pos)++;
-      arg1 = evaluate_subexp_with_coercion (exp, pos, noside);
-      arg2 = evaluate_subexp_with_coercion (exp, pos, noside);
-      return eval_op_m2_subscript (expect_type, exp, noside, arg1, arg2);
-
-    default:
-      return evaluate_subexp_standard (expect_type, exp, pos, noside);
-    }
-}
-\f
-
-/* Table of operators and their precedences for printing expressions.  */
-
-const struct op_print m2_language::op_print_tab[] =
-{
-  {"+", BINOP_ADD, PREC_ADD, 0},
-  {"+", UNOP_PLUS, PREC_PREFIX, 0},
-  {"-", BINOP_SUB, PREC_ADD, 0},
-  {"-", UNOP_NEG, PREC_PREFIX, 0},
-  {"*", BINOP_MUL, PREC_MUL, 0},
-  {"/", BINOP_DIV, PREC_MUL, 0},
-  {"DIV", BINOP_INTDIV, PREC_MUL, 0},
-  {"MOD", BINOP_REM, PREC_MUL, 0},
-  {":=", BINOP_ASSIGN, PREC_ASSIGN, 1},
-  {"OR", BINOP_LOGICAL_OR, PREC_LOGICAL_OR, 0},
-  {"AND", BINOP_LOGICAL_AND, PREC_LOGICAL_AND, 0},
-  {"NOT", UNOP_LOGICAL_NOT, PREC_PREFIX, 0},
-  {"=", BINOP_EQUAL, PREC_EQUAL, 0},
-  {"<>", BINOP_NOTEQUAL, PREC_EQUAL, 0},
-  {"<=", BINOP_LEQ, PREC_ORDER, 0},
-  {">=", BINOP_GEQ, PREC_ORDER, 0},
-  {">", BINOP_GTR, PREC_ORDER, 0},
-  {"<", BINOP_LESS, PREC_ORDER, 0},
-  {"^", UNOP_IND, PREC_PREFIX, 0},
-  {"@", BINOP_REPEAT, PREC_REPEAT, 0},
-  {"CAP", UNOP_CAP, PREC_BUILTIN_FUNCTION, 0},
-  {"CHR", UNOP_CHR, PREC_BUILTIN_FUNCTION, 0},
-  {"ORD", UNOP_ORD, PREC_BUILTIN_FUNCTION, 0},
-  {"FLOAT", UNOP_FLOAT, PREC_BUILTIN_FUNCTION, 0},
-  {"HIGH", UNOP_HIGH, PREC_BUILTIN_FUNCTION, 0},
-  {"MAX", UNOP_MAX, PREC_BUILTIN_FUNCTION, 0},
-  {"MIN", UNOP_MIN, PREC_BUILTIN_FUNCTION, 0},
-  {"ODD", UNOP_ODD, PREC_BUILTIN_FUNCTION, 0},
-  {"TRUNC", UNOP_TRUNC, PREC_BUILTIN_FUNCTION, 0},
-  {NULL, OP_NULL, PREC_BUILTIN_FUNCTION, 0}
-};
 \f
 
-const struct exp_descriptor m2_language::exp_descriptor_modula2 =
-{
-  print_subexp_standard,
-  operator_length_standard,
-  operator_check_standard,
-  dump_subexp_body_standard,
-  evaluate_subexp_modula2
-};
-
 /* Single instance of the M2 language.  */
 
 static m2_language m2_language_defn;
This page took 0.02671 seconds and 4 git commands to generate.