[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[MAIN] macro-to-muscle.patch
From: |
marc-alexandre autret |
Subject: |
[MAIN] macro-to-muscle.patch |
Date: |
Sat, 1 Sep 2001 02:34:45 +0000 (GMT) |
Hi,
Another patch to change macro to muscle.
two files have been renamed, macrotab.[ch].
? src/muscle_tab.c
? src/muscle_tab.h
Index: ChangeLog
===================================================================
RCS file: /cvsroot/bison/bison/ChangeLog,v
retrieving revision 1.204
diff -u -r1.204 ChangeLog
--- ChangeLog 2001/08/31 18:51:06 1.204
+++ ChangeLog 2001/09/01 00:25:43
@@ -1,3 +1,43 @@
+2001-09-01 Marc Autret <address@hidden>
+
+ * src/reader.c: Include muscle_tab.h.
+ (parse_union_decl): Update.
+ (parse_macro_decl): Rename parse_macro_decl.
+ Update to use renamed functions and variable.
+ (read_declarations, copy_action, read_additionnal_code, : Updated
+ with correct variables and functions names.
+ (packsymbols, reader): Likewise.
+
+ * src/reader.h (muscle_obstack): Extern declaration update.
+
+ * src/output.c: Include muscle_tab.h
+ In all functions using macro_insert, change by using muscle_insert ().
+ (macro_obstack): Rename muscle_obstack.
+ Echo modifications in the whole file.
+ (MACRO_INSERT_INT): Rename MUSCLE_INSERT_INT.
+ (MACRO_INSERT_STRING): Rename MUSCLE_INSERT_STRING.
+ (MACRO_INSERT_PREFIX): Rename MUSCLE_INSERT_PREFIX.
+
+ * src/muscle_tab.h: Update double inclusion macros.
+ (macro_entry_s): Rename muscle_entry_s.
+ Update prototypes.
+
+ * src/muscle_tab.c: Include muscle_tab.h.
+ Rename macro_tabble to muscle_table.
+ (mhash1, mhash2, mcmp): Use muscle_entry.
+ (macro_init): Use muscle_entry.
+ Use muscle_insert ().
+ (macro_insert): Rename muscle_insert.
+ Use muscle_entry.
+ (macro_find): Rename muscle_find.
+ Use muscle_find.
+
+ * src/main.c: Include muscle_tab.h.
+ (main): Call muscle_init ().
+ * src/Makefile.am (bison_SOURCES): Echo modifications.
+ * src/macrotab.c: Rename muscle_tab.c.
+ * src/macrotab.h: Rename muscle_tab.h.
+
2001-08-31 Pascal Bart <address@hidden>
* src/output.c (prepare): Delete the `filename' muscule insertion.
Index: TODO
===================================================================
RCS file: /cvsroot/bison/bison/TODO,v
retrieving revision 1.7
diff -u -r1.7 TODO
--- TODO 2001/08/31 23:24:55 1.7
+++ TODO 2001/09/01 00:25:43
@@ -17,6 +17,10 @@
* src/macrotab.[ch]
** Removing warnings when compiling. (gcc-warnings) [ok].
** s/macro/muscle/
+*** Rename files.
+*** Rename functions
+*** Echo modifications src/Makefile src/output.c src/reader.c
+*** src/main.c src/macrotab.c
* src/print_graph.c
** Find the best graph parameters.
Index: src/Makefile.am
===================================================================
RCS file: /cvsroot/bison/bison/src/Makefile.am,v
retrieving revision 1.28
diff -u -r1.28 Makefile.am
--- src/Makefile.am 2001/08/25 14:21:46 1.28
+++ src/Makefile.am 2001/09/01 00:25:43
@@ -13,19 +13,19 @@
bison_SOURCES = LR0.c closure.c complain.c conflicts.c \
derives.c \
files.c getargs.c gram.c lalr.c lex.c main.c nullable.c \
- output.c \
- macrotab.c \
- print.c reader.c reduce.c symtab.c warshall.c vcg.c print_graph.c
+ output.c print_graph.c \
+ muscle_tab.c \
+ print.c reader.c reduce.c symtab.c warshall.c vcg.c
EXTRA_bison_SOURCES = vmsgetargs.c
noinst_HEADERS = LR0.h closure.h complain.h conflicts.h \
derives.h \
files.h getargs.h gram.h lalr.h lex.h nullable.h \
- output.h state.h \
- macrotab.h \
- print.h reader.h reduce.h symtab.h warshall.h system.h types.h \
- vcg.h vcg_defaults.h print_graph.h
+ output.h print_graph.h \
+ muscle_tab.h \
+ print.h reader.h reduce.h state.h symtab.h warshall.h system.h \
+ types.h vcg.h vcg_defaults.h
pkgdata_DATA = bison.simple bison.hairy
Index: src/main.c
===================================================================
RCS file: /cvsroot/bison/bison/src/main.c,v
retrieving revision 1.35
diff -u -r1.35 main.c
--- src/main.c 2001/08/31 16:56:44 1.35
+++ src/main.c 2001/09/01 00:25:43
@@ -34,7 +34,7 @@
#include "LR0.h"
#include "conflicts.h"
#include "print_graph.h"
-#include "macrotab.h"
+#include "muscle_tab.h"
/* The name this program was run with, for messages. */
char *program_name;
@@ -52,7 +52,7 @@
lineno = 0;
getargs (argc, argv);
- macro_init ();
+ muscle_init ();
open_files ();
/* Read the input. Copy some parts of it to FGUARD, FACTION, FTABLE
Index: src/output.c
===================================================================
RCS file: /cvsroot/bison/bison/src/output.c,v
retrieving revision 1.54
diff -u -r1.54 output.c
--- src/output.c 2001/08/31 18:51:06 1.54
+++ src/output.c 2001/09/01 00:25:44
@@ -103,7 +103,7 @@
#include "lalr.h"
#include "reader.h"
#include "conflicts.h"
-#include "macrotab.h"
+#include "muscle_tab.h"
extern void berror PARAMS((const char *));
@@ -123,7 +123,7 @@
static int lowzero;
static int high;
-struct obstack macro_obstack;
+struct obstack muscle_obstack;
struct obstack output_obstack;
/* FIXME. */
@@ -160,7 +160,7 @@
{
output_table_data (&output_obstack, token_translations,
0, 1, max_user_token_number + 1);
- macro_insert ("translate", obstack_finish (&output_obstack));
+ muscle_insert ("translate", obstack_finish (&output_obstack));
}
@@ -169,7 +169,7 @@
{
output_table_data (&output_obstack, rrhs,
0, 1, nrules + 1);
- macro_insert ("prhs", obstack_finish (&output_obstack));
+ muscle_insert ("prhs", obstack_finish (&output_obstack));
{
size_t yyrhs_size = 1;
@@ -185,7 +185,7 @@
output_table_data (&output_obstack, yyrhs,
ritem[0], 1, yyrhs_size);
- macro_insert ("rhs", obstack_finish (&output_obstack));
+ muscle_insert ("rhs", obstack_finish (&output_obstack));
XFREE (yyrhs);
}
@@ -202,7 +202,7 @@
{
output_table_data (&output_obstack, accessing_symbol,
0, 1, nstates);
- macro_insert ("stos", obstack_finish (&output_obstack));
+ muscle_insert ("stos", obstack_finish (&output_obstack));
}
@@ -215,7 +215,7 @@
output_table_data (&output_obstack, rline,
0, 1, nrules + 1);
- macro_insert ("rline", obstack_finish (&output_obstack));
+ muscle_insert ("rline", obstack_finish (&output_obstack));
j = 0;
for (i = 0; i < nsyms; i++)
@@ -267,17 +267,17 @@
/* Finish table and store. */
obstack_1grow (&output_obstack, 0);
- macro_insert ("tname", obstack_finish (&output_obstack));
+ muscle_insert ("tname", obstack_finish (&output_obstack));
/* Output YYTOKNUM. */
output_table_data (&output_obstack, user_toknums,
0, 1, ntokens + 1);
- macro_insert ("toknum", obstack_finish (&output_obstack));
+ muscle_insert ("toknum", obstack_finish (&output_obstack));
/* Output YYR1. */
output_table_data (&output_obstack, rlhs,
0, 1, nrules + 1);
- macro_insert ("r1", obstack_finish (&output_obstack));
+ muscle_insert ("r1", obstack_finish (&output_obstack));
XFREE (rlhs + 1);
/* Output YYR2. */
@@ -287,7 +287,7 @@
short_tab[nrules] = nitems - rrhs[nrules] - 1;
output_table_data (&output_obstack, short_tab,
0, 1, nrules + 1);
- macro_insert ("r2", obstack_finish (&output_obstack));
+ muscle_insert ("r2", obstack_finish (&output_obstack));
XFREE (short_tab);
XFREE (rrhs + 1);
@@ -536,7 +536,7 @@
output_table_data (&output_obstack, yydefact,
yydefact[0], 1, nstates);
- macro_insert ("defact", obstack_finish (&output_obstack));
+ muscle_insert ("defact", obstack_finish (&output_obstack));
XFREE (actrow);
XFREE (yydefact);
@@ -677,7 +677,7 @@
output_table_data (&output_obstack, yydefgoto,
yydefgoto[0], 1, nsyms - ntokens);
- macro_insert ("defgoto", obstack_finish (&output_obstack));
+ muscle_insert ("defgoto", obstack_finish (&output_obstack));
XFREE (state_count);
XFREE (yydefgoto);
@@ -882,12 +882,12 @@
/* Output pact. */
output_table_data (&output_obstack, base,
base[0], 1, nstates);
- macro_insert ("pact", obstack_finish (&output_obstack));
+ muscle_insert ("pact", obstack_finish (&output_obstack));
/* Output pgoto. */
output_table_data (&output_obstack, base,
base[nstates], nstates + 1, nvectors);
- macro_insert ("pgoto", obstack_finish (&output_obstack));
+ muscle_insert ("pgoto", obstack_finish (&output_obstack));
XFREE (base);
}
@@ -898,7 +898,7 @@
{
output_table_data (&output_obstack, table,
table[0], 1, high + 1);
- macro_insert ("table", obstack_finish (&output_obstack));
+ muscle_insert ("table", obstack_finish (&output_obstack));
XFREE (table);
}
@@ -908,7 +908,7 @@
{
output_table_data (&output_obstack, check,
check[0], 1, high + 1);
- macro_insert ("check", obstack_finish (&output_obstack));
+ muscle_insert ("check", obstack_finish (&output_obstack));
XFREE (check);
}
@@ -983,21 +983,21 @@
}
else if ((c = getc (fskel)) == '%')
{
- /* Read the macro. */
- const char *macro_key = 0;
- const char *macro_value = 0;
+ /* Read the muscle. */
+ const char *muscle_key = 0;
+ const char *muscle_value = 0;
while (isalnum (c = getc (fskel)) || c == '_')
- obstack_1grow (¯o_obstack, c);
- obstack_1grow (¯o_obstack, 0);
+ obstack_1grow (&muscle_obstack, c);
+ obstack_1grow (&muscle_obstack, 0);
/* Output the right value, or see if it's something special. */
- macro_key = obstack_finish (¯o_obstack);
- macro_value = macro_find (macro_key);
- if (macro_value)
- obstack_sgrow (&table_obstack, macro_value);
- else if (!strcmp (macro_key, "line"))
+ muscle_key = obstack_finish (&muscle_obstack);
+ muscle_value = muscle_find (muscle_key);
+ if (muscle_value)
+ obstack_sgrow (&table_obstack, muscle_value);
+ else if (!strcmp (muscle_key, "line"))
obstack_fgrow1 (&table_obstack, "%d", line + 1);
- else if (!strcmp (macro_key, "action"))
+ else if (!strcmp (muscle_key, "action"))
{
size_t size = obstack_object_size (&action_obstack);
obstack_grow (&table_obstack,
@@ -1006,7 +1006,7 @@
else
{
obstack_sgrow (&table_obstack, "%%");
- obstack_sgrow (&table_obstack, macro_key);
+ obstack_sgrow (&table_obstack, muscle_key);
}
}
else
@@ -1033,49 +1033,49 @@
/* FIXME. */
-#define MACRO_INSERT_INT(Key, Value) \
-{ \
- obstack_fgrow1 (¯o_obstack, "%d", Value); \
- obstack_1grow (¯o_obstack, 0); \
- macro_insert (Key, obstack_finish (¯o_obstack)); \
+#define MUSCLE_INSERT_INT(Key, Value) \
+{ \
+ obstack_fgrow1 (&muscle_obstack, "%d", Value); \
+ obstack_1grow (&muscle_obstack, 0); \
+ muscle_insert (Key, obstack_finish (&muscle_obstack)); \
}
-#define MACRO_INSERT_STRING(Key, Value) \
-{ \
- obstack_sgrow (¯o_obstack, Value); \
- obstack_1grow (¯o_obstack, 0); \
- macro_insert (Key, obstack_finish (¯o_obstack)); \
+#define MUSCLE_INSERT_STRING(Key, Value) \
+{ \
+ obstack_sgrow (&muscle_obstack, Value); \
+ obstack_1grow (&muscle_obstack, 0); \
+ muscle_insert (Key, obstack_finish (&muscle_obstack)); \
}
-#define MACRO_INSERT_PREFIX(Key, Value)
\
+#define MUSCLE_INSERT_PREFIX(Key, Value) \
{ \
- obstack_fgrow2 (¯o_obstack, "%s%s", spec_name_prefix, Value); \
- obstack_1grow (¯o_obstack, 0); \
- macro_insert (Key, obstack_finish (¯o_obstack)); \
+ obstack_fgrow2 (&muscle_obstack, "%s%s", spec_name_prefix, Value); \
+ obstack_1grow (&muscle_obstack, 0); \
+ muscle_insert (Key, obstack_finish (&muscle_obstack)); \
}
static void
prepare (void)
{
- MACRO_INSERT_INT ("last", high);
- MACRO_INSERT_INT ("flag", MINSHORT);
- MACRO_INSERT_INT ("pure", pure_parser);
- MACRO_INSERT_INT ("nsym", nsyms);
- MACRO_INSERT_INT ("debug", debug_flag);
- MACRO_INSERT_INT ("final", final_state);
- MACRO_INSERT_INT ("maxtok", max_user_token_number);
- MACRO_INSERT_INT ("ntbase", ntokens);
- MACRO_INSERT_INT ("verbose", 0);
-
- MACRO_INSERT_INT ("nnts", nvars);
- MACRO_INSERT_INT ("nrules", nrules);
- MACRO_INSERT_INT ("nstates", nstates);
- MACRO_INSERT_INT ("ntokens", ntokens);
+ MUSCLE_INSERT_INT ("last", high);
+ MUSCLE_INSERT_INT ("flag", MINSHORT);
+ MUSCLE_INSERT_INT ("pure", pure_parser);
+ MUSCLE_INSERT_INT ("nsym", nsyms);
+ MUSCLE_INSERT_INT ("debug", debug_flag);
+ MUSCLE_INSERT_INT ("final", final_state);
+ MUSCLE_INSERT_INT ("maxtok", max_user_token_number);
+ MUSCLE_INSERT_INT ("ntbase", ntokens);
+ MUSCLE_INSERT_INT ("verbose", 0);
+
+ MUSCLE_INSERT_INT ("nnts", nvars);
+ MUSCLE_INSERT_INT ("nrules", nrules);
+ MUSCLE_INSERT_INT ("nstates", nstates);
+ MUSCLE_INSERT_INT ("ntokens", ntokens);
- MACRO_INSERT_INT ("locations_flag", locations_flag);
+ MUSCLE_INSERT_INT ("locations_flag", locations_flag);
if (spec_name_prefix)
- MACRO_INSERT_STRING ("prefix", spec_name_prefix);
+ MUSCLE_INSERT_STRING ("prefix", spec_name_prefix);
}
/*----------------------------------------------------------.
@@ -1106,9 +1106,9 @@
#endif
prepare ();
/* Copy definitions in directive. */
- macro_insert ("prologue", obstack_finish (&attrs_obstack));
+ muscle_insert ("prologue", obstack_finish (&attrs_obstack));
output_parser ();
- obstack_free (¯o_obstack, 0);
+ obstack_free (&muscle_obstack, 0);
obstack_free (&output_obstack, 0);
}
Index: src/reader.c
===================================================================
RCS file: /cvsroot/bison/bison/src/reader.c,v
retrieving revision 1.83
diff -u -r1.83 reader.c
--- src/reader.c 2001/08/31 18:51:06 1.83
+++ src/reader.c 2001/09/01 00:25:44
@@ -34,7 +34,7 @@
#include "output.h"
#include "reader.h"
#include "conflicts.h"
-#include "macrotab.h"
+#include "muscle_tab.h"
/* Number of slots allocated (but not necessarily used yet) in `rline' */
static int rline_allocated;
@@ -750,7 +750,7 @@
if (!no_lines_flag)
obstack_fgrow2 (&attrs_obstack, "\n#line %d %s\n",
lineno, quotearg_style (c_quoting_style,
- macro_find("filename")));
+ muscle_find("filename")));
else
obstack_1grow (&attrs_obstack, '\n');
@@ -903,11 +903,11 @@
/* FIXME. */
static void
-parse_macro_decl (void)
+parse_muscle_decl (void)
{
int ch = ungetc (skip_white_space (), finput);
- char* macro_key;
- char* macro_value;
+ char* muscle_key;
+ char* muscle_value;
/* Read key. */
if (!isalpha (ch) && ch != '_')
@@ -916,9 +916,9 @@
skip_to_char ('%');
return;
}
- copy_identifier (finput, ¯o_obstack);
- obstack_1grow (¯o_obstack, 0);
- macro_key = obstack_finish (¯o_obstack);
+ copy_identifier (finput, &muscle_obstack);
+ obstack_1grow (&muscle_obstack, 0);
+ muscle_key = obstack_finish (&muscle_obstack);
/* Read value. */
ch = skip_white_space ();
@@ -934,12 +934,12 @@
else
fatal (_("Premature EOF after %s"), "\"");
}
- copy_string2 (finput, ¯o_obstack, '"', 0);
- obstack_1grow (¯o_obstack, 0);
- macro_value = obstack_finish (¯o_obstack);
+ copy_string2 (finput, &muscle_obstack, '"', 0);
+ obstack_1grow (&muscle_obstack, 0);
+ muscle_value = obstack_finish (&muscle_obstack);
/* Store the (key, value) pair in the environment. */
- macro_insert (macro_key, macro_value);
+ muscle_insert (muscle_key, muscle_value);
}
@@ -1061,7 +1061,7 @@
break;
case tok_define:
- parse_macro_decl ();
+ parse_muscle_decl ();
break;
case tok_skel:
@@ -1113,7 +1113,7 @@
{
sprintf (buf, "#line %d %s\n",
lineno, quotearg_style (c_quoting_style,
- macro_find ("filename")));
+ muscle_find ("filename")));
obstack_grow (&action_obstack, buf, strlen (buf));
}
obstack_1grow (&action_obstack, '{');
@@ -1682,7 +1682,7 @@
obstack_1grow (&el_obstack, c);
obstack_1grow (&el_obstack, 0);
- macro_insert ("epilogue", obstack_finish (&el_obstack));
+ muscle_insert ("epilogue", obstack_finish (&el_obstack));
}
@@ -1852,7 +1852,7 @@
output_token_defines (&output_obstack);
obstack_1grow (&output_obstack, 0);
- macro_insert ("tokendef", obstack_finish (&output_obstack));
+ muscle_insert ("tokendef", obstack_finish (&output_obstack));
#if 0
if (!no_parser_flag)
@@ -2004,8 +2004,8 @@
init_lex ();
lineno = 1;
- /* Initialize the macro obstack. */
- obstack_init (¯o_obstack);
+ /* Initialize the muscle obstack. */
+ obstack_init (&muscle_obstack);
/* Initialize the symbol table. */
tabinit ();
Index: src/reader.h
===================================================================
RCS file: /cvsroot/bison/bison/src/reader.h,v
retrieving revision 1.3
diff -u -r1.3 reader.h
--- src/reader.h 2001/08/27 14:55:39 1.3
+++ src/reader.h 2001/09/01 00:25:44
@@ -36,6 +36,6 @@
extern char **tags;
extern short *user_toknums;
-extern struct obstack macro_obstack;
+extern struct obstack muscle_obstack;
#endif /* !READER_H_ */
--
Autret Marc (address@hidden)
Eleve Ingenieur en Informatique.
muscle_tab.c
Description: Text document
muscle_tab.h
Description: Text document
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [MAIN] macro-to-muscle.patch,
marc-alexandre autret <=