static void output_base(void) { int i, j; start_int_table("sindex", base[0]); j = 10; for (i = 1; i < nstates; i++) { if (j >= 10) { output_newline(); j = 1; } else ++j; output_int(base[i]); } end_table(); start_int_table("rindex", base[nstates]); j = 10; for (i = nstates + 1; i < 2 * nstates; i++) { if (j >= 10) { output_newline(); j = 1; } else ++j; output_int(base[i]); } end_table(); start_int_table("gindex", base[2 * nstates]); j = 10; for (i = 2 * nstates + 1; i < nvectors - 1; i++) { if (j >= 10) { output_newline(); j = 1; } else ++j; output_int(base[i]); } end_table(); FREE(base); }
static void output_check(void) { int i; int j; start_int_table("check", check[0]); j = 10; for (i = 1; i <= high; i++) { if (j >= 10) { output_newline(); j = 1; } else ++j; output_int(check[i]); } end_table(); FREE(check); }
static void output_table(void) { int i; int j; ++outline; fprintf(code_file, "#define YYTABLESIZE %d\n", high); start_int_table("table", table[0]); j = 10; for (i = 1; i <= high; i++) { if (j >= 10) { output_newline(); j = 1; } else ++j; output_int(table[i]); } end_table(); FREE(table); }
static void goto_actions(void) { int i, j, k; state_count = NEW2(nstates, Value_t); k = default_goto(start_symbol + 1); start_int_table("dgoto", k); save_column(start_symbol + 1, k); j = 10; for (i = start_symbol + 2; i < nsyms; i++) { if (j >= 10) { output_newline(); j = 1; } else ++j; k = default_goto(i); output_int(k); save_column(i, k); } end_table(); FREE(state_count); }
static void output_rule_data(void) { int i; int j; output_YYINT_typedef(output_file); start_int_table("lhs", symbol_value[start_symbol]); j = 10; for (i = 3; i < nrules; i++) { if (j >= 10) { output_newline(); j = 1; } else ++j; output_int(symbol_value[rlhs[i]]); } end_table(); start_int_table("len", 2); j = 10; for (i = 3; i < nrules; i++) { if (j >= 10) { output_newline(); j = 1; } else j++; output_int(rrhs[i + 1] - rrhs[i] - 1); } end_table(); }
static void output_accessing_symbols(void) { int i, j; int *translate; if (nstates != 0) { translate = TMALLOC(int, nstates); NO_SPACE(translate); for (i = 0; i < nstates; ++i) { int gsymb = accessing_symbol[i]; translate[i] = symbol_pval[gsymb]; } putl_code(output_file, "#if defined(YYDESTRUCT_CALL) || defined(YYSTYPE_TOSTRING)\n"); /* yystos[] may be unused, depending on compile-time defines */ start_int_table("stos", translate[0]); j = 10; for (i = 1; i < nstates; ++i) { if (j < 10) ++j; else { output_newline(); j = 1; } output_int(translate[i]); } end_table(); FREE(translate); putl_code(output_file, "#endif /* YYDESTRUCT_CALL || YYSTYPE_TOSTRING */\n"); }
static void output_yydefred (void) { int i, j; start_int_table ("defred", (defred[0] ? defred[0] - 2 : 0)); j = 10; for (i = 1; i < nstates; i++) { if (j < 10) ++j; else { output_newline (); j = 1; } output_int ((defred[i] ? defred[i] - 2 : 0)); } end_table (); }
static void output_accessing_symbols(void) { int i, j; int *translate; if (nstates != 0) { translate = TMALLOC(int, nstates); NO_SPACE(translate); for (i = 0; i < nstates; ++i) { int gsymb = accessing_symbol[i]; translate[i] = symbol_pval[gsymb]; } /* yystos[] may be unused, depending on compile-time defines */ start_int_table("stos", translate[0]); j = 10; for (i = 1; i < nstates; ++i) { if (j < 10) ++j; else { output_newline(); j = 1; } output_int(translate[i]); } end_table(); FREE(translate); }