#include <ctype.h>
#endif
-/* Prototypes for local functions */
-
-static void print_subexp (struct expression *, int *, struct ui_file *,
- enum precedence);
-
void
print_expression (struct expression *exp, struct ui_file *stream)
{
if the precedence of the main operator of this subexpression is less,
parentheses are needed here. */
-static void
+void
print_subexp (struct expression *exp, int *pos,
struct ui_file *stream, enum precedence prec)
+{
+ exp->language_defn->la_exp_desc->print_subexp (exp, pos, stream, prec);
+}
+
+/* Standard implementation of print_subexp for use in language_defn
+ vectors. */
+void
+print_subexp_standard (struct expression *exp, int *pos,
+ struct ui_file *stream, enum precedence prec)
{
unsigned tem;
const struct op_print *op_print_tab;
/* Support for dumping the raw data from expressions in a human readable
form. */
-static char *op_name (int opcode);
+static char *op_name (struct expression *, enum exp_opcode);
static int dump_subexp_body (struct expression *exp, struct ui_file *, int);
+/* Name for OPCODE, when it appears in expression EXP. */
+
static char *
-op_name (int opcode)
+op_name (struct expression *exp, enum exp_opcode opcode)
+{
+ return exp->language_defn->la_exp_desc->op_name (opcode);
+}
+
+/* Default name for the standard operator OPCODE (i.e., one defined in
+ the definition of enum exp_opcode). */
+
+char *
+op_name_standard (enum exp_opcode opcode)
{
switch (opcode)
{
for (elt = 0; elt < exp->nelts; elt++)
{
fprintf_filtered (stream, "\t%5d ", elt);
- opcode_name = op_name (exp->elts[elt].opcode);
+ opcode_name = op_name (exp, exp->elts[elt].opcode);
fprintf_filtered (stream, "%20s ", opcode_name);
print_longest (stream, 'd', 0, exp->elts[elt].longconst);
fprintf_filtered (stream, " ");
indent += 2;
- fprintf_filtered (stream, "%-20s ", op_name (exp->elts[elt].opcode));
+ fprintf_filtered (stream, "%-20s ", op_name (exp, exp->elts[elt].opcode));
elt = dump_subexp_body (exp, stream, elt);
static int
dump_subexp_body (struct expression *exp, struct ui_file *stream, int elt)
+{
+ return exp->language_defn->la_exp_desc->dump_subexp_body (exp, stream, elt);
+}
+
+/* Default value for subexp_body in exp_descriptor vector. */
+
+int
+dump_subexp_body_standard (struct expression *exp,
+ struct ui_file *stream, int elt)
{
int opcode = exp->elts[elt++].opcode;