(format_obstack): this, to avoid any confusion with files.c's
output_obstack.
* src/reader.h (muscle_obstack): Move to...
* src/output.h: here, since it's defined in output.c.
+2001-12-17 Akim Demaille <akim@epita.fr>
+
+ * src/output.c (output_obstack): Be static and rename as...
+ (format_obstack): this, to avoid any confusion with files.c's
+ output_obstack.
+ * src/reader.h (muscle_obstack): Move to...
+ * src/output.h: here, since it's defined in output.c.
+
+
2001-12-17 Akim Demaille <akim@epita.fr>
* src/output.c (action_row, save_column, default_goto)
2001-12-17 Akim Demaille <akim@epita.fr>
* src/output.c (action_row, save_column, default_goto)
static int high;
struct obstack muscle_obstack;
static int high;
struct obstack muscle_obstack;
-struct obstack output_obstack;
+static struct obstack format_obstack;
static void
output_token_translations (void)
{
static void
output_token_translations (void)
{
- output_table_data (&output_obstack, token_translations,
+ output_table_data (&format_obstack, token_translations,
0, 1, max_user_token_number + 1);
0, 1, max_user_token_number + 1);
- muscle_insert ("translate", obstack_finish (&output_obstack));
+ muscle_insert ("translate", obstack_finish (&format_obstack));
XFREE (token_translations);
}
XFREE (token_translations);
}
short *values = XCALLOC (short, nrules + 1);
for (i = 0; i < nrules + 1; ++i)
values[i] = rule_table[i].rhs;
short *values = XCALLOC (short, nrules + 1);
for (i = 0; i < nrules + 1; ++i)
values[i] = rule_table[i].rhs;
- output_table_data (&output_obstack, values,
+ output_table_data (&format_obstack, values,
0, 1, nrules + 1);
XFREE (values);
}
0, 1, nrules + 1);
XFREE (values);
}
- muscle_insert ("prhs", obstack_finish (&output_obstack));
+ muscle_insert ("prhs", obstack_finish (&format_obstack));
for (sp = ritem + 1, i = 1; *sp; ++sp, ++i)
yyrhs[i] = *sp > 0 ? *sp : 0;
for (sp = ritem + 1, i = 1; *sp; ++sp, ++i)
yyrhs[i] = *sp > 0 ? *sp : 0;
- output_table_data (&output_obstack, yyrhs,
+ output_table_data (&format_obstack, yyrhs,
ritem[0], 1, yyrhs_size);
ritem[0], 1, yyrhs_size);
- muscle_insert ("rhs", obstack_finish (&output_obstack));
+ muscle_insert ("rhs", obstack_finish (&format_obstack));
short *values = (short *) alloca (sizeof (short) * nstates);
for (i = 0; i < nstates; ++i)
values[i] = state_table[i]->accessing_symbol;
short *values = (short *) alloca (sizeof (short) * nstates);
for (i = 0; i < nstates; ++i)
values[i] = state_table[i]->accessing_symbol;
- output_table_data (&output_obstack, values,
+ output_table_data (&format_obstack, values,
- muscle_insert ("stos", obstack_finish (&output_obstack));
+ muscle_insert ("stos", obstack_finish (&format_obstack));
short *values = XCALLOC (short, nrules + 1);
for (i = 0; i < nrules + 1; ++i)
values[i] = rule_table[i].line;
short *values = XCALLOC (short, nrules + 1);
for (i = 0; i < nrules + 1; ++i)
values[i] = rule_table[i].line;
- output_table_data (&output_obstack, values,
+ output_table_data (&format_obstack, values,
- muscle_insert ("rline", obstack_finish (&output_obstack));
+ muscle_insert ("rline", obstack_finish (&format_obstack));
- obstack_sgrow (&output_obstack, "\n ");
+ obstack_sgrow (&format_obstack, "\n ");
- obstack_sgrow (&output_obstack, cp);
- obstack_sgrow (&output_obstack, ", ");
+ obstack_sgrow (&format_obstack, cp);
+ obstack_sgrow (&format_obstack, ", ");
j += strsize;
}
/* add a NULL entry to list of tokens */
j += strsize;
}
/* add a NULL entry to list of tokens */
- obstack_sgrow (&output_obstack, "NULL");
+ obstack_sgrow (&format_obstack, "NULL");
/* Finish table and store. */
/* Finish table and store. */
- obstack_1grow (&output_obstack, 0);
- muscle_insert ("tname", obstack_finish (&output_obstack));
+ obstack_1grow (&format_obstack, 0);
+ muscle_insert ("tname", obstack_finish (&format_obstack));
- output_table_data (&output_obstack, user_toknums,
+ output_table_data (&format_obstack, user_toknums,
- muscle_insert ("toknum", obstack_finish (&output_obstack));
+ muscle_insert ("toknum", obstack_finish (&format_obstack));
/* Output YYR1. */
{
short *values = XCALLOC (short, nrules + 1);
for (i = 0; i < nrules + 1; ++i)
values[i] = rule_table[i].lhs;
/* Output YYR1. */
{
short *values = XCALLOC (short, nrules + 1);
for (i = 0; i < nrules + 1; ++i)
values[i] = rule_table[i].lhs;
- output_table_data (&output_obstack, values,
+ output_table_data (&format_obstack, values,
- muscle_insert ("r1", obstack_finish (&output_obstack));
+ muscle_insert ("r1", obstack_finish (&format_obstack));
for (i = 1; i < nrules; i++)
short_tab[i] = rule_table[i + 1].rhs - rule_table[i].rhs - 1;
short_tab[nrules] = nitems - rule_table[nrules].rhs - 1;
for (i = 1; i < nrules; i++)
short_tab[i] = rule_table[i + 1].rhs - rule_table[i].rhs - 1;
short_tab[nrules] = nitems - rule_table[nrules].rhs - 1;
- output_table_data (&output_obstack, short_tab,
+ output_table_data (&format_obstack, short_tab,
- muscle_insert ("r2", obstack_finish (&output_obstack));
+ muscle_insert ("r2", obstack_finish (&format_obstack));
- output_table_data (&output_obstack, yydefact,
+ output_table_data (&format_obstack, yydefact,
yydefact[0], 1, nstates);
yydefact[0], 1, nstates);
- muscle_insert ("defact", obstack_finish (&output_obstack));
+ muscle_insert ("defact", obstack_finish (&format_obstack));
XFREE (actrow);
XFREE (yydefact);
XFREE (actrow);
XFREE (yydefact);
yydefgoto[i - ntokens] = default_state;
}
yydefgoto[i - ntokens] = default_state;
}
- output_table_data (&output_obstack, yydefgoto,
+ output_table_data (&format_obstack, yydefgoto,
yydefgoto[0], 1, nsyms - ntokens);
yydefgoto[0], 1, nsyms - ntokens);
- muscle_insert ("defgoto", obstack_finish (&output_obstack));
+ muscle_insert ("defgoto", obstack_finish (&format_obstack));
XFREE (state_count);
XFREE (yydefgoto);
XFREE (state_count);
XFREE (yydefgoto);
output_base (void)
{
/* Output pact. */
output_base (void)
{
/* Output pact. */
- output_table_data (&output_obstack, base,
+ output_table_data (&format_obstack, base,
- muscle_insert ("pact", obstack_finish (&output_obstack));
+ muscle_insert ("pact", obstack_finish (&format_obstack));
- output_table_data (&output_obstack, base,
+ output_table_data (&format_obstack, base,
base[nstates], nstates + 1, nvectors);
base[nstates], nstates + 1, nvectors);
- muscle_insert ("pgoto", obstack_finish (&output_obstack));
+ muscle_insert ("pgoto", obstack_finish (&format_obstack));
static void
output_table (void)
{
static void
output_table (void)
{
- output_table_data (&output_obstack, table,
+ output_table_data (&format_obstack, table,
- muscle_insert ("table", obstack_finish (&output_obstack));
+ muscle_insert ("table", obstack_finish (&format_obstack));
static void
output_check (void)
{
static void
output_check (void)
{
- output_table_data (&output_obstack, check,
+ output_table_data (&format_obstack, check,
- muscle_insert ("check", obstack_finish (&output_obstack));
+ muscle_insert ("check", obstack_finish (&format_obstack));
- obstack_init (&output_obstack);
+ obstack_init (&format_obstack);
output_token_translations ();
output_gram ();
output_token_translations ();
output_gram ();
free (rule_table + 1);
obstack_free (&muscle_obstack, 0);
free (rule_table + 1);
obstack_free (&muscle_obstack, 0);
- obstack_free (&output_obstack, 0);
+ obstack_free (&format_obstack, 0);
obstack_free (&action_obstack, 0);
}
obstack_free (&action_obstack, 0);
}
/* Output the parsing tables and the parser code to FTABLE. */
void output PARAMS ((void));
/* Output the parsing tables and the parser code to FTABLE. */
void output PARAMS ((void));
+extern struct obstack muscle_obstack;
+
/* Input parser for bison
/* Input parser for bison
- Copyright 2000 Free Software Foundation, Inc.
+ Copyright 2000, 2001 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
This file is part of Bison, the GNU Compiler Compiler.
extern char **tags;
extern short *user_toknums;
extern char **tags;
extern short *user_toknums;
-extern struct obstack muscle_obstack;
-