static void prepare_symbols (void) { MUSCLE_INSERT_INT ("tokens_number", ntokens); MUSCLE_INSERT_INT ("nterms_number", nvars); MUSCLE_INSERT_INT ("symbols_number", nsyms); MUSCLE_INSERT_INT ("undef_token_number", undeftoken->number); MUSCLE_INSERT_INT ("user_token_number_max", max_user_token_number); muscle_insert_symbol_number_table ("translate", token_translations, token_translations[0], 1, max_user_token_number + 1); /* tname -- token names. */ { int i; /* We assume that the table will be output starting at column 2. */ int j = 2; struct quoting_options *qo = clone_quoting_options (0); set_quoting_style (qo, c_quoting_style); set_quoting_flags (qo, QA_SPLIT_TRIGRAPHS); for (i = 0; i < nsyms; i++) { char *cp = quotearg_alloc (symbols[i]->tag, -1, qo); /* Width of the next token, including the two quotes, the comma and the space. */ int width = strlen (cp) + 2; if (j + width > 75) { obstack_sgrow (&format_obstack, "\n "); j = 1; } if (i) obstack_1grow (&format_obstack, ' '); obstack_escape (&format_obstack, cp); free (cp); obstack_1grow (&format_obstack, ','); j += width; } free (qo); obstack_sgrow (&format_obstack, " ]b4_null["); /* Finish table and store. */ muscle_insert ("tname", obstack_finish0 (&format_obstack)); } /* Output YYTOKNUM. */ { int i; int *values = xnmalloc (ntokens, sizeof *values); for (i = 0; i < ntokens; ++i) values[i] = symbols[i]->user_token_number; muscle_insert_int_table ("toknum", values, values[0], 1, ntokens); free (values); } }
static void muscle_boundary_grow (char const *key, boundary bound) { char *extension; obstack_sgrow (&muscle_obstack, "[["); obstack_escape (&muscle_obstack, bound.file); obstack_printf (&muscle_obstack, ":%d.%d]]", bound.line, bound.column); extension = obstack_finish0 (&muscle_obstack); muscle_grow (key, extension, "", ""); obstack_free (&muscle_obstack, extension); }