[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFA] muscle changes for Java support
From: |
Paul Eggert |
Subject: |
Re: [RFA] muscle changes for Java support |
Date: |
Tue, 12 Sep 2006 10:28:16 -0700 |
User-agent: |
Gnus/5.1008 (Gnus v5.10.8) Emacs/21.4 (gnu/linux) |
Thanks; I installed the following slightly-different patch.
The differences avoid white-space changes in Bison's output,
omit unnecessary quoting around integers, and coalesce printfs.
2006-09-12 Paolo Bonzini <address@hidden> (tiny change)
* data/c.m4 (b4_null, b4_case): Define.
* src/output.c (prepare_symbols): Use b4_null.
(user_actions_output): Use b4_case.
--- data/c.m4 11 Aug 2006 19:50:14 -0000 1.64
+++ data/c.m4 12 Sep 2006 17:23:58 -0000
@@ -81,7 +81,6 @@ m4_define([b4_identification],
])
-
## ---------------- ##
## Default values. ##
## ---------------- ##
@@ -100,7 +99,6 @@ m4_define_default([b4_location_initial_l
## Pure/impure interfaces. ##
## ------------------------ ##
-
# b4_user_args
# ------------
m4_define([b4_user_args],
@@ -137,11 +135,11 @@ m4_define([b4_parse_param_use],
])dnl
])
+
## ------------ ##
## Data Types. ##
## ------------ ##
-
# b4_ints_in(INT1, INT2, LOW, HIGH)
# ---------------------------------
# Return 1 iff both INT1 and INT2 are in [LOW, HIGH], 0 otherwise.
@@ -173,6 +171,17 @@ m4_define([b4_int_type_for],
[b4_int_type($1_min, $1_max)])
+## ---------##
+## Values. ##
+## ---------##
+
+# b4_null
+---------
+# Return a null pointer constant. NULL infringes on the user name
+# space in C, so use 0 rather than NULL.
+m4_define([b4_null], [0])
+
+
## ------------------ ##
## Decoding options. ##
## ------------------ ##
@@ -458,6 +467,13 @@ b4_define_user_code([stype])
## User actions. ##
## -------------- ##
+# b4_case(LABEL, STATEMENTS)
+# --------------------------
+m4_define([b4_case],
+[ case $1:
+$2
+ break;])
+
# b4_symbol_actions(FILENAME, LINENO,
# SYMBOL-TAG, SYMBOL-NUM,
# SYMBOL-ACTION, SYMBOL-TYPENAME)
--- src/output.c 29 Jul 2006 05:53:41 -0000 1.252
+++ src/output.c 12 Sep 2006 17:23:58 -0000
@@ -176,9 +176,7 @@ prepare_symbols (void)
obstack_1grow (&format_obstack, ',');
j += width;
}
- /* Add a NULL entry to list of tokens (well, 0, as NULL might not be
- defined). */
- obstack_sgrow (&format_obstack, " 0");
+ obstack_sgrow (&format_obstack, " ]b4_null[");
/* Finish table and store. */
obstack_1grow (&format_obstack, 0);
@@ -290,20 +288,16 @@ user_actions_output (FILE *out)
{
rule_number r;
- fputs ("m4_define([b4_actions], \n[[", out);
+ fputs ("m4_define([b4_actions], \n[", out);
for (r = 0; r < nrules; ++r)
if (rules[r].action)
{
- fprintf (out, " case %d:\n", r + 1);
-
- fprintf (out, "]b4_syncline(%d, ",
+ fprintf (out, "b4_case(%d, [b4_syncline(%d, ", r + 1,
rules[r].action_location.start.line);
escaped_output (out, rules[r].action_location.start.file);
- fprintf (out, ")[\n");
- fprintf (out, " %s\n break;\n\n",
- rules[r].action);
+ fprintf (out, ")\n[ %s]])\n\n", rules[r].action);
}
- fputs ("]])\n\n", out);
+ fputs ("])\n\n", out);
}
/*--------------------------------------.