mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-22 18:53:04 +00:00
* 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.
This commit is contained in:
@@ -1,3 +1,12 @@
|
|||||||
|
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>
|
2001-12-17 Akim Demaille <akim@epita.fr>
|
||||||
|
|
||||||
* src/output.c (action_row, save_column, default_goto)
|
* src/output.c (action_row, save_column, default_goto)
|
||||||
|
|||||||
74
src/output.c
74
src/output.c
@@ -121,7 +121,7 @@ static int lowzero;
|
|||||||
static int high;
|
static int high;
|
||||||
|
|
||||||
struct obstack muscle_obstack;
|
struct obstack muscle_obstack;
|
||||||
struct obstack output_obstack;
|
static struct obstack format_obstack;
|
||||||
|
|
||||||
int error_verbose = 0;
|
int error_verbose = 0;
|
||||||
|
|
||||||
@@ -174,9 +174,9 @@ output_table_data (struct obstack *oout,
|
|||||||
static void
|
static void
|
||||||
output_token_translations (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);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -189,12 +189,12 @@ output_gram (void)
|
|||||||
short *values = XCALLOC (short, nrules + 1);
|
short *values = XCALLOC (short, nrules + 1);
|
||||||
for (i = 0; i < nrules + 1; ++i)
|
for (i = 0; i < nrules + 1; ++i)
|
||||||
values[i] = rule_table[i].rhs;
|
values[i] = rule_table[i].rhs;
|
||||||
output_table_data (&output_obstack, values,
|
output_table_data (&format_obstack, values,
|
||||||
0, 1, nrules + 1);
|
0, 1, nrules + 1);
|
||||||
XFREE (values);
|
XFREE (values);
|
||||||
}
|
}
|
||||||
|
|
||||||
muscle_insert ("prhs", obstack_finish (&output_obstack));
|
muscle_insert ("prhs", obstack_finish (&format_obstack));
|
||||||
|
|
||||||
{
|
{
|
||||||
size_t yyrhs_size = 1;
|
size_t yyrhs_size = 1;
|
||||||
@@ -208,9 +208,9 @@ output_gram (void)
|
|||||||
for (sp = ritem + 1, i = 1; *sp; ++sp, ++i)
|
for (sp = ritem + 1, i = 1; *sp; ++sp, ++i)
|
||||||
yyrhs[i] = *sp > 0 ? *sp : 0;
|
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));
|
||||||
|
|
||||||
XFREE (yyrhs);
|
XFREE (yyrhs);
|
||||||
}
|
}
|
||||||
@@ -229,9 +229,9 @@ output_stos (void)
|
|||||||
short *values = (short *) alloca (sizeof (short) * nstates);
|
short *values = (short *) alloca (sizeof (short) * nstates);
|
||||||
for (i = 0; i < nstates; ++i)
|
for (i = 0; i < nstates; ++i)
|
||||||
values[i] = state_table[i]->accessing_symbol;
|
values[i] = state_table[i]->accessing_symbol;
|
||||||
output_table_data (&output_obstack, values,
|
output_table_data (&format_obstack, values,
|
||||||
0, 1, nstates);
|
0, 1, nstates);
|
||||||
muscle_insert ("stos", obstack_finish (&output_obstack));
|
muscle_insert ("stos", obstack_finish (&format_obstack));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -246,9 +246,9 @@ output_rule_data (void)
|
|||||||
short *values = XCALLOC (short, nrules + 1);
|
short *values = XCALLOC (short, nrules + 1);
|
||||||
for (i = 0; i < nrules + 1; ++i)
|
for (i = 0; i < nrules + 1; ++i)
|
||||||
values[i] = rule_table[i].line;
|
values[i] = rule_table[i].line;
|
||||||
output_table_data (&output_obstack, values,
|
output_table_data (&format_obstack, values,
|
||||||
0, 1, nrules + 1);
|
0, 1, nrules + 1);
|
||||||
muscle_insert ("rline", obstack_finish (&output_obstack));
|
muscle_insert ("rline", obstack_finish (&format_obstack));
|
||||||
XFREE (values);
|
XFREE (values);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -266,34 +266,34 @@ output_rule_data (void)
|
|||||||
|
|
||||||
if (j + strsize > 75)
|
if (j + strsize > 75)
|
||||||
{
|
{
|
||||||
obstack_sgrow (&output_obstack, "\n ");
|
obstack_sgrow (&format_obstack, "\n ");
|
||||||
j = 2;
|
j = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
obstack_sgrow (&output_obstack, cp);
|
obstack_sgrow (&format_obstack, cp);
|
||||||
obstack_sgrow (&output_obstack, ", ");
|
obstack_sgrow (&format_obstack, ", ");
|
||||||
j += strsize;
|
j += strsize;
|
||||||
}
|
}
|
||||||
/* add a NULL entry to list of tokens */
|
/* 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);
|
obstack_1grow (&format_obstack, 0);
|
||||||
muscle_insert ("tname", obstack_finish (&output_obstack));
|
muscle_insert ("tname", obstack_finish (&format_obstack));
|
||||||
|
|
||||||
/* Output YYTOKNUM. */
|
/* Output YYTOKNUM. */
|
||||||
output_table_data (&output_obstack, user_toknums,
|
output_table_data (&format_obstack, user_toknums,
|
||||||
0, 1, ntokens + 1);
|
0, 1, ntokens + 1);
|
||||||
muscle_insert ("toknum", obstack_finish (&output_obstack));
|
muscle_insert ("toknum", obstack_finish (&format_obstack));
|
||||||
|
|
||||||
/* Output YYR1. */
|
/* Output YYR1. */
|
||||||
{
|
{
|
||||||
short *values = XCALLOC (short, nrules + 1);
|
short *values = XCALLOC (short, nrules + 1);
|
||||||
for (i = 0; i < nrules + 1; ++i)
|
for (i = 0; i < nrules + 1; ++i)
|
||||||
values[i] = rule_table[i].lhs;
|
values[i] = rule_table[i].lhs;
|
||||||
output_table_data (&output_obstack, values,
|
output_table_data (&format_obstack, values,
|
||||||
0, 1, nrules + 1);
|
0, 1, nrules + 1);
|
||||||
muscle_insert ("r1", obstack_finish (&output_obstack));
|
muscle_insert ("r1", obstack_finish (&format_obstack));
|
||||||
XFREE (values);
|
XFREE (values);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -302,9 +302,9 @@ output_rule_data (void)
|
|||||||
for (i = 1; i < nrules; i++)
|
for (i = 1; i < nrules; i++)
|
||||||
short_tab[i] = rule_table[i + 1].rhs - rule_table[i].rhs - 1;
|
short_tab[i] = rule_table[i + 1].rhs - rule_table[i].rhs - 1;
|
||||||
short_tab[nrules] = nitems - rule_table[nrules].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,
|
||||||
0, 1, nrules + 1);
|
0, 1, nrules + 1);
|
||||||
muscle_insert ("r2", obstack_finish (&output_obstack));
|
muscle_insert ("r2", obstack_finish (&format_obstack));
|
||||||
XFREE (short_tab);
|
XFREE (short_tab);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -496,9 +496,9 @@ token_actions (void)
|
|||||||
save_row (i);
|
save_row (i);
|
||||||
}
|
}
|
||||||
|
|
||||||
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 (actrow);
|
||||||
XFREE (yydefact);
|
XFREE (yydefact);
|
||||||
@@ -628,9 +628,9 @@ goto_actions (void)
|
|||||||
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 (state_count);
|
||||||
XFREE (yydefgoto);
|
XFREE (yydefgoto);
|
||||||
@@ -813,14 +813,14 @@ static void
|
|||||||
output_base (void)
|
output_base (void)
|
||||||
{
|
{
|
||||||
/* Output pact. */
|
/* Output pact. */
|
||||||
output_table_data (&output_obstack, base,
|
output_table_data (&format_obstack, base,
|
||||||
base[0], 1, nstates);
|
base[0], 1, nstates);
|
||||||
muscle_insert ("pact", obstack_finish (&output_obstack));
|
muscle_insert ("pact", obstack_finish (&format_obstack));
|
||||||
|
|
||||||
/* Output pgoto. */
|
/* Output pgoto. */
|
||||||
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));
|
||||||
|
|
||||||
XFREE (base);
|
XFREE (base);
|
||||||
}
|
}
|
||||||
@@ -829,9 +829,9 @@ output_base (void)
|
|||||||
static void
|
static void
|
||||||
output_table (void)
|
output_table (void)
|
||||||
{
|
{
|
||||||
output_table_data (&output_obstack, table,
|
output_table_data (&format_obstack, table,
|
||||||
table[0], 1, high + 1);
|
table[0], 1, high + 1);
|
||||||
muscle_insert ("table", obstack_finish (&output_obstack));
|
muscle_insert ("table", obstack_finish (&format_obstack));
|
||||||
XFREE (table);
|
XFREE (table);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -839,9 +839,9 @@ output_table (void)
|
|||||||
static void
|
static void
|
||||||
output_check (void)
|
output_check (void)
|
||||||
{
|
{
|
||||||
output_table_data (&output_obstack, check,
|
output_table_data (&format_obstack, check,
|
||||||
check[0], 1, high + 1);
|
check[0], 1, high + 1);
|
||||||
muscle_insert ("check", obstack_finish (&output_obstack));
|
muscle_insert ("check", obstack_finish (&format_obstack));
|
||||||
XFREE (check);
|
XFREE (check);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1066,7 +1066,7 @@ yystype;\n\
|
|||||||
void
|
void
|
||||||
output (void)
|
output (void)
|
||||||
{
|
{
|
||||||
obstack_init (&output_obstack);
|
obstack_init (&format_obstack);
|
||||||
|
|
||||||
output_token_translations ();
|
output_token_translations ();
|
||||||
output_gram ();
|
output_gram ();
|
||||||
@@ -1091,6 +1091,6 @@ output (void)
|
|||||||
|
|
||||||
free (rule_table + 1);
|
free (rule_table + 1);
|
||||||
obstack_free (&muscle_obstack, 0);
|
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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,4 +26,6 @@ extern int error_verbose;
|
|||||||
/* Output the parsing tables and the parser code to FTABLE. */
|
/* Output the parsing tables and the parser code to FTABLE. */
|
||||||
void output PARAMS ((void));
|
void output PARAMS ((void));
|
||||||
|
|
||||||
|
extern struct obstack muscle_obstack;
|
||||||
|
|
||||||
#endif /* !OUTPUT_H_ */
|
#endif /* !OUTPUT_H_ */
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* 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.
|
||||||
|
|
||||||
@@ -34,6 +34,4 @@ extern int lineno;
|
|||||||
extern char **tags;
|
extern char **tags;
|
||||||
extern short *user_toknums;
|
extern short *user_toknums;
|
||||||
|
|
||||||
extern struct obstack muscle_obstack;
|
|
||||||
|
|
||||||
#endif /* !READER_H_ */
|
#endif /* !READER_H_ */
|
||||||
|
|||||||
Reference in New Issue
Block a user