-#include "conflicts.h"
-#include "muscle_tab.h"
-
-/* From lib/readpipe.h. */
-FILE *readpipe PARAMS ((const char *, ...));
-
-/* From src/scan-skel.l. */
-int skel_lex PARAMS ((void));
-extern FILE *skel_in;
-
-static int nvectors;
-static int nentries;
-static short **froms = NULL;
-static short **tos = NULL;
-static short *tally = NULL;
-static short *width = NULL;
-static short *actrow = NULL;
-static short *state_count = NULL;
-static short *order = NULL;
-static short *base = NULL;
-static short *pos = NULL;
-static short *table = NULL;
-static short *check = NULL;
-static int lowzero;
-static int high;
-
-struct obstack muscle_obstack;
-static struct obstack format_obstack;
-
-int error_verbose = 0;
-
-/* Returns the number of lines of S. */
-size_t
-get_lines_number (const char *s)
-{
- size_t lines = 0;
-
- size_t i;
- for (i = 0; s[i]; ++i)
- if (s[i] == '\n')
- ++lines;
-
- return lines;
-}
-
-
-/* FIXME. */
-
-static inline void
-output_table_data (struct obstack *oout,
- short *table_data,
- short first,
- int begin,
- int end)
-{
- int i;
- int j = 1;
-
- obstack_fgrow1 (oout, "%6d", first);
- for (i = begin; i < end; ++i)
- {
- obstack_1grow (oout, ',');
- if (j >= 10)
- {
- obstack_sgrow (oout, "\n ");
- j = 1;
- }
- else
- ++j;
- obstack_fgrow1 (oout, "%6d", table_data[i]);
- }
- obstack_1grow (oout, 0);
-}
-
-
-static void
-output_token_translations (void)
-{
- output_table_data (&format_obstack, token_translations,
- 0, 1, max_user_token_number + 1);
- muscle_insert ("translate", obstack_finish (&format_obstack));
- XFREE (token_translations);
-}
-
-
-static void
-output_gram (void)
-{
- {
- int i;
- short *values = XCALLOC (short, nrules + 1);
- for (i = 0; i < nrules + 1; ++i)
- values[i] = rules[i].rhs - ritem;
- output_table_data (&format_obstack, values,
- 0, 1, nrules + 1);
- XFREE (values);
- }
-
- muscle_insert ("prhs", obstack_finish (&format_obstack));
-
- {
- short *yyrhs;
- int i;
-
- yyrhs = XMALLOC (short, nritems);
-
- for (i = 1; i < nritems; ++i)
- yyrhs[i] = ritem[i] >= 0 ? ritem[i] : -1;
-
- output_table_data (&format_obstack, yyrhs,
- ritem[0], 1, nritems);
- muscle_insert ("rhs", obstack_finish (&format_obstack));
-
- XFREE (yyrhs);
- }
-
-#if 0
- if (!semantic_parser)
- obstack_sgrow (&table_obstack, "\n#endif\n");
-#endif
-}
-
-
-static void
-output_stos (void)
-{
- size_t i;
- short *values = (short *) alloca (sizeof (short) * nstates);
- for (i = 0; i < nstates; ++i)
- values[i] = states[i]->accessing_symbol;
- output_table_data (&format_obstack, values,
- 0, 1, nstates);
- muscle_insert ("stos", obstack_finish (&format_obstack));
-}
-
-
-static void
-output_rule_data (void)
-{
- int i;
- int j;
- short *short_tab = NULL;