X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=src%2Ftexsourc%2Fitex.c;h=843df60b8070d1b062a4677ade5581db432f5e7d;hb=f5b49406be6d357d6af3924c17337c626b67e249;hp=0f7dfda2a6630167afb637e68ce24b7612f0b731;hpb=d8792736a3bc5aef18cedd4a78851e46246bbf0a;p=putex%2Fputex.git diff --git a/src/texsourc/itex.c b/src/texsourc/itex.c index 0f7dfda..843df60 100644 --- a/src/texsourc/itex.c +++ b/src/texsourc/itex.c @@ -19,13 +19,11 @@ #define EXTERN extern -#include "texd.h" +#include "yandytex.h" #define BEGINFMTCHECKSUM 367403084L #define ENDFMTCHECKSUM 69069L -extern clock_t start_time, main_time, finish_time; - #ifdef INITEX void do_initex (void); #endif @@ -33,9 +31,9 @@ extern clock_t start_time, main_time, finish_time; /* sec 0004 */ void initialize (void) { - integer i; - integer k; - integer flag; /* bkph */ + integer i; + integer k; + integer flag; #ifndef ALLOCATEHYPHEN hyph_pointer z; @@ -81,7 +79,7 @@ void initialize (void) } for (i = 0; i <= 255; i++) - xord[chr(i)] = 127; + xord[chr(i)] = invalid_code; #ifdef JOKE for (i = 128; i <= 255 ; i++) @@ -139,7 +137,7 @@ void initialize (void) nest_ptr = 0; max_nest_stack = 0; - mode = 1; + mode = vmode; head = contrib_head; tail = contrib_head; prev_depth = ignore_depth; @@ -154,10 +152,10 @@ void initialize (void) #endif link(page_head) = 0; - last_glue = empty_flag; + last_glue = max_halfword; last_penalty = 0; last_kern = 0; - page_so_far[7] = 0; + page_depth = 0; page_max_depth = 0; for (k = int_base; k <= eqtb_size; k++) @@ -182,25 +180,25 @@ void initialize (void) cur_mark[3] = 0; cur_mark[4] = 0; cur_val = 0; - cur_val_level = 0; + cur_val_level = int_val; radix = 0; - cur_order = 0; + cur_order = normal; for (k = 0; k <= 16; k++) - read_open[k] = 2; + read_open[k] = closed; cond_ptr = 0; - if_limit = 0; + if_limit = normal; cur_if = 0; if_line = 0; for (k = 0; k <= font_max; k++) font_used[k] = false; - null_character.b0 = 0; - null_character.b1 = 0; - null_character.b2 = 0; - null_character.b3 = 0; + null_character.b0 = min_quarterword; + null_character.b1 = min_quarterword; + null_character.b2 = min_quarterword; + null_character.b3 = min_quarterword; total_pages = 0; max_v = 0; max_h = 0; @@ -260,9 +258,7 @@ void initialize (void) #ifdef INITEX if (is_initex) - { do_initex(); - } #endif } @@ -281,7 +277,7 @@ void initialize_aux (void) /* nest_ptr = 0; */ /* max_nest_stack = 0; */ - mode = 1; + mode = vmode; head = contrib_head; tail = contrib_head; prev_depth = ignore_depth; @@ -292,18 +288,18 @@ void initialize_aux (void) page_tail = page_head; link(page_head) = 0; } -#endif // end of ifdef ALLOCATEMAIN +#endif /* sec 0815 */ -void line_break_ (integer final_widow_penalty) +void line_break (integer final_widow_penalty) { boolean auto_breaking; - halfword prev_p; - halfword q, r, s, prevs; + pointer prev_p; + pointer q, r, s, prev_s; internal_font_number f; -/* small_number j; */ - int j; /* 95/Jan/7 */ -/* unsigned char c; */ - unsigned int c; /* 95/Jan/7 */ + /* small_number j; */ + int j; + /* unsigned char c; */ + unsigned int c; pack_begin_line = mode_line; link(temp_head) = link(head); @@ -387,9 +383,9 @@ void line_break_ (integer final_widow_penalty) } if (looseness == 0) - easyline = last_special_line; + easy_line = last_special_line; else - easyline = empty_flag; + easy_line = empty_flag; threshold = pretolerance; @@ -405,7 +401,7 @@ void line_break_ (integer final_widow_penalty) second_pass = false; final_pass = false; - first_pass_count++; /* 96 Feb 9 */ + first_pass_count++; } else { @@ -435,11 +431,11 @@ void line_break_ (integer final_widow_penalty) #endif cur_lang = init_cur_lang; - lhyf = init_l_hyf; - rhyf = init_r_hyf; + l_hyf = init_l_hyf; + r_hyf = init_r_hyf; } - q = get_node(3); + q = get_node(active_node_size); type(q) = unhyphenated; fitness(q) = decent_fit; link(q) = active; @@ -448,17 +444,11 @@ void line_break_ (integer final_widow_penalty) total_demerits(q) = 0; link(active) = q; act_width = background[1]; - active_width[2] = background[2]; - active_width[3] = background[3]; - active_width[4] = background[4]; - active_width[5] = background[5]; - active_width[6] = background[6]; - + do_all_six(store_background); passive = 0; printed_node = temp_head; pass_number = 0; - font_in_short_display = 0; - + font_in_short_display = null_font; cur_p = link(temp_head); auto_breaking = true; prev_p = cur_p; @@ -490,8 +480,8 @@ void line_break_ (integer final_widow_penalty) if (subtype(cur_p) == language_node) { cur_lang = what_lang(cur_p); - lhyf = what_lhm(cur_p); - rhyf = what_rhm(cur_p); + l_hyf = what_lhm(cur_p); + r_hyf = what_rhm(cur_p); } break; @@ -501,7 +491,7 @@ void line_break_ (integer final_widow_penalty) { if (is_char_node(prev_p)) try_break(0, unhyphenated); - else if ((mem[prev_p].hh.b0 < 9)) + else if (precedes_break(prev_p)) try_break(0, unhyphenated); else if ((type(prev_p) == kern_node) && (subtype(prev_p) != explicit)) try_break(0, unhyphenated); @@ -515,8 +505,8 @@ void line_break_ (integer final_widow_penalty) if (second_pass && auto_breaking) { - prevs = cur_p; - s = link(prevs); + prev_s = cur_p; + s = link(prev_s); if (s != 0) { @@ -543,8 +533,8 @@ void line_break_ (integer final_widow_penalty) if (subtype(s) == language_node) { cur_lang = what_lang(s); - lhyf = what_lhm(s); - rhyf = what_rhm(s); + l_hyf = what_lhm(s); + r_hyf = what_rhm(s); } goto continu; } @@ -552,13 +542,13 @@ void line_break_ (integer final_widow_penalty) goto done1; if (lc_code(c) != 0) - if ((lc_code(c) == (halfword) c) || (uc_hyph > 0)) /* fixed signed tyoe */ + if ((lc_code(c) == (halfword) c) || (uc_hyph > 0)) goto done2; else goto done1; continu: - prevs = s; - s = link(prevs); + prev_s = s; + s = link(prev_s); } done2: hyf_char = hyphen_char[hf]; @@ -567,11 +557,11 @@ done2: goto done1; if (hyf_char > 255) - goto done1; /* ? */ + goto done1; - ha = prevs; + ha = prev_s; - if (lhyf + rhyf > 63) + if (l_hyf + r_hyf > 63) goto done1; hn = 0; @@ -583,9 +573,9 @@ done2: if (font(s) != hf) goto done3; - hyfbchar = character(s); + hyf_bchar = character(s); - c = hyfbchar; /* unsigned char c; */ + c = hyf_bchar; if (lc_code(c) == 0) goto done3; @@ -597,7 +587,7 @@ done2: incr(hn); hu[hn] = c; hc[hn]= lc_code(c); - hyfbchar = non_char; + hyf_bchar = non_char; } else if (type(s) == ligature_node) { @@ -607,10 +597,10 @@ done2: j = hn; q = lig_ptr(s); - if (q != 0) /* 94/Mar/23 BUG FIX */ - hyfbchar = character(q); + if (q != 0) + hyf_bchar = character(q); - while (q != 0) /* 94/Mar/23 BUG FIX */ + while (q != 0) { c = character(q); @@ -630,22 +620,22 @@ done2: hn = j; if (odd(subtype(s))) - hyfbchar = font_bchar[hf]; + hyf_bchar = font_bchar[hf]; else - hyfbchar = non_char; + hyf_bchar = non_char; } else if ((type(s) == kern_node) && (subtype(s) == normal)) { hb = s; - hyfbchar = font_bchar[hf]; + hyf_bchar = font_bchar[hf]; } else goto done3; s = link(s); } -done3:; - if (hn < lhyf + rhyf) +done3: + if (hn < l_hyf + r_hyf) goto done1; while (true) @@ -655,10 +645,12 @@ done3:; { case ligature_node: break; + case kern_node: if (subtype(s) != normal) goto done4; break; + case whatsit_node: case glue_node: case penalty_node: @@ -667,31 +659,35 @@ done3:; case mark_node: goto done4; break; + default: goto done1; break; } s = link(s); } -done4:; +done4: hyphenate(); } done1:; } } break; + case kern_node: if (subtype(cur_p) == explicit) kern_break(); else act_width = act_width + width(cur_p); break; + case ligature_node: { f = font(lig_char(cur_p)); act_width = act_width + char_width(f, char_info(f, character(lig_char(cur_p)))); } break; + case disc_node: { s = pre_break(cur_p); @@ -702,41 +698,45 @@ done1:; else { do - { - if (is_char_node(s)) - { - f = font(s); - disc_width = disc_width + char_width(f, char_info(f, character(s))); - } - else switch (type(s)) { - case ligature_node: - { - f = font(lig_char(s)); - disc_width = disc_width + font_info[width_base[f] + font_info[char_base[f]+ mem[s + 1].hh.b1].qqqq.b0].cint; - } - break; - case hlist_node: - case vlist_node: - case rule_node: - case kern_node: - disc_width = disc_width + width(s); - break; - default: - { - confusion("disc3"); - return; - } - break; + if (is_char_node(s)) + { + f = font(s); + disc_width = disc_width + char_width(f, char_info(f, character(s))); + } + else switch (type(s)) + { + case ligature_node: + { + f = font(lig_char(s)); + disc_width = disc_width + char_width(f, char_info(f, character(lig_char(s)))); + } + break; + + case hlist_node: + case vlist_node: + case rule_node: + case kern_node: + disc_width = disc_width + width(s); + break; + + default: + { + confusion("disc3"); + return; + } + break; + } + + s = link(s); } - s = link(s); - } while (!(s == 0)); act_width = act_width + disc_width; try_break(hyphen_penalty, hyphenated); act_width = act_width - disc_width; } + r = replace_count(cur_p); s = link(cur_p); @@ -821,7 +821,7 @@ done5:; do { - if (type(r) != 2) + if (type(r) != delta_node) if (total_demerits(r) < fewest_demerits) { fewest_demerits = total_demerits(r); @@ -836,7 +836,7 @@ done5:; if (looseness == 0) { - goto done; /* normal exit */ + goto done; } { @@ -845,7 +845,7 @@ done5:; do { - if (type(r) != 2) + if (type(r) != delta_node) { line_diff = toint(line_number(r)) - toint(best_line); @@ -908,7 +908,7 @@ done5:; #endif threshold = tolerance; second_pass = true; - second_pass_count++; /* 96 Feb 9 */ + second_pass_count++; final_pass = (emergency_stretch <= 0); } else @@ -920,12 +920,12 @@ done5:; background[2] = background[2] + emergency_stretch; final_pass = true; - ++final_pass_count; /* 96 Feb 9 */ + ++final_pass_count; } } done: - if (best_line == 2) + if (best_line == decent_fit) single_line++; #ifdef STAT @@ -1004,7 +1004,7 @@ void prefixed_command (void) prints("' or `"); print_esc("outer"); prints("' with `"); - print_cmd_chr(cur_cmd, cur_chr); + print_cmd_chr(cur_cmd, cur_chr); print_char('\''); help1("I'll pretend you didn't say \\long or \\outer here."); error(); @@ -1282,7 +1282,7 @@ void prefixed_command (void) scan_optional_equals(); scan_int(); - if (((cur_val < 0) && (p < del_code_base)) ||(cur_val > n)) + if (((cur_val < 0) && (p < del_code_base)) || (cur_val > n)) { print_err("Invalid code("); print_int(cur_val); @@ -1497,12 +1497,12 @@ boolean load_fmt_file (void) if (trace_flag) printf("Read from fmt file mem_top = %lld TeX words\n", x); - mem = allocate_main_memory(x); /* allocate main memory at this point */ + mem = allocate_main_memory(x); if (mem == NULL) - exit(1); /* redundant sanity test ! */ + exit(EXIT_FAILURE); - initialize_aux(); /* do `mem' part of initialize */ + initialize_aux(); /* do `mem' part of initialize */ #endif if (x != mem_top) @@ -1541,7 +1541,7 @@ boolean load_fmt_file (void) if (trace_flag) printf("undump string pool reallocation (%lld > %d)\n", x, current_pool_size); - str_pool = realloc_str_pool (x - current_pool_size + increment_pool_size); + str_pool = realloc_str_pool(x - current_pool_size + increment_pool_size); } if (x > current_pool_size) @@ -1549,7 +1549,7 @@ boolean load_fmt_file (void) if (x > pool_size) #endif { - printf("%s%s\n", "---! Must increase the ", "string pool size"); + printf("%s%s\n", "---! Must increase the ", "string pool size"); goto bad_fmt; } else @@ -1571,24 +1571,20 @@ boolean load_fmt_file (void) str_start = realloc_str_start(x - current_max_strings + increment_max_strings); } - if (x > current_max_strings) /* 94/Jan/24 */ + if (x > current_max_strings) #else if (x > max_strings) #endif { - printf("%s%s\n", "---! Must increase the ", "max strings"); + printf("%s%s\n", "---! Must increase the ", "max strings"); goto bad_fmt; } else str_ptr = x; } - if (undumpthings(str_start[0], str_ptr + 1)) /* undump string ptrs */ - return -1; - - if (undumpthings(str_pool[0], pool_ptr)) /* undump string pool */ - return -1; - + undumpthings(str_start[0], str_ptr + 1); + undumpthings(str_pool[0], pool_ptr); init_str_ptr = str_ptr; init_pool_ptr = pool_ptr; undump(lo_mem_stat_max + 1000, hi_mem_stat_min - 1, lo_mem_max); @@ -1613,7 +1609,7 @@ boolean load_fmt_file (void) if (undumpthings(mem[p], lo_mem_max + 1 - p)) return -1; - if (mem_min < mem_bot - 2) /* ? splice in block below */ + if (mem_min < mem_bot - 2) { /* or call add_variable_space(mem_bot - (mem_min + 1)) */ if (trace_flag) @@ -1719,94 +1715,32 @@ boolean load_fmt_file (void) } { - if (undumpthings(font_info[0], fmem_ptr)) - return -1; - - { - undump_int(x); /* font_max */ - - if (x < 0) - goto bad_fmt; - - if (x > font_max) - { - puts("---! Must increase the font max"); - goto bad_fmt; - } - else - font_ptr = x; - } - + undumpthings(font_info[0], fmem_ptr); + undump_size(font_base, font_max, "font max", font_ptr); frozen_font_ptr = font_ptr; - - if (undumpthings(font_check[0], font_ptr + 1)) - return -1; - - if (undumpthings(font_size[0], font_ptr + 1)) - return -1; - - if (undumpthings(font_dsize[0], font_ptr + 1)) - return -1; - - if (undumpthings(font_params[0], font_ptr + 1)) - return -1; - - if (undumpthings(hyphen_char[0], font_ptr + 1)) - return -1; - - if (undumpthings(skew_char[0], font_ptr + 1)) - return -1; - - if (undumpthings(font_name[0], font_ptr + 1)) - return -1; - - if (undumpthings(font_area[0], font_ptr + 1)) - return -1; - - if (undumpthings(font_bc[0], font_ptr + 1)) - return -1; - - if (undumpthings(font_ec[0], font_ptr + 1)) - return -1; - - if (undumpthings(char_base[0], font_ptr + 1)) - return -1; - - if (undumpthings(width_base[0], font_ptr + 1)) - return -1; - - if (undumpthings(height_base[0], font_ptr + 1)) - return -1; - - if (undumpthings(depth_base[0], font_ptr + 1)) - return -1; - - if (undumpthings(italic_base[0], font_ptr + 1)) - return -1; - - if (undumpthings(lig_kern_base[0], font_ptr + 1)) - return -1; - - if (undumpthings(kern_base[0], font_ptr + 1)) - return -1; - - if (undumpthings(exten_base[0], font_ptr + 1)) - return -1; - - if (undumpthings(param_base[0], font_ptr + 1)) - return -1; - - if (undumpthings(font_glue[0], font_ptr + 1)) - return -1; - - if (undumpthings(bchar_label[0], font_ptr + 1)) - return -1; - - if (undumpthings(font_bchar[0], font_ptr + 1)) - return -1; - - if (undumpthings(font_false_bchar[0], font_ptr + 1)) - return -1; + undumpthings(font_check[0], font_ptr + 1); + undumpthings(font_size[0], font_ptr + 1); + undumpthings(font_dsize[0], font_ptr + 1); + undumpthings(font_params[0], font_ptr + 1); + undumpthings(hyphen_char[0], font_ptr + 1); + undumpthings(skew_char[0], font_ptr + 1); + undumpthings(font_name[0], font_ptr + 1); + undumpthings(font_area[0], font_ptr + 1); + undumpthings(font_bc[0], font_ptr + 1); + undumpthings(font_ec[0], font_ptr + 1); + undumpthings(char_base[0], font_ptr + 1); + undumpthings(width_base[0], font_ptr + 1); + undumpthings(height_base[0], font_ptr + 1); + undumpthings(depth_base[0], font_ptr + 1); + undumpthings(italic_base[0], font_ptr + 1); + undumpthings(lig_kern_base[0], font_ptr + 1); + undumpthings(kern_base[0], font_ptr + 1); + undumpthings(exten_base[0], font_ptr + 1); + undumpthings(param_base[0], font_ptr + 1); + undumpthings(font_glue[0], font_ptr + 1); + undumpthings(bchar_label[0], font_ptr + 1); + undumpthings(font_bchar[0], font_ptr + 1); + undumpthings(font_false_bchar[0], font_ptr + 1); } /* log not opened yet, so can't show fonts frozen into format */ @@ -1873,13 +1807,12 @@ boolean load_fmt_file (void) if (!is_initex) { allocate_tries(x); /* allocate only as much as is needed */ -/* trie_size = x; */ /* ??? */ } #endif if (x > trie_size) { - puts("---! Must increase the trie size\n"); + puts("---! Must increase the trie size"); goto bad_fmt; } else @@ -1891,43 +1824,19 @@ boolean load_fmt_file (void) trie_max = j; #endif - if (undumpthings(trie_trl[0], j + 1)) - return -1; - - if (undumpthings(trie_tro[0], j + 1)) - return -1; - - if (undumpthings(trie_trc[0], j + 1)) - return -1; - - { - undump_int(x); - - if (x < 0) - goto bad_fmt; - - if (x > trie_op_size) - { - puts("---! Must increase the trie op size\n"); - goto bad_fmt; - } - else - j = x; - } + undumpthings(trie_trl[0], j + 1); + undumpthings(trie_tro[0], j + 1); + undumpthings(trie_trc[0], j + 1); + undump_size(0, trie_op_size, "trie op size", j); #ifdef INITEX if (is_initex) trie_op_ptr = j; #endif - if (undumpthings(hyf_distance[1], j)) - return -1; - - if (undumpthings(hyf_num[1], j)) - return -1; - - if (undumpthings(hyf_next[1], j)) - return -1; + undumpthings(hyf_distance[1], j); + undumpthings(hyf_num[1], j); + undumpthings(hyf_next[1], j); #ifdef INITEX if (is_initex) @@ -1967,8 +1876,8 @@ boolean load_fmt_file (void) return true; -bad_fmt:; - puts("(Fatal format file error; I'm stymied)\n"); +bad_fmt: + puts("(Fatal format file error; I'm stymied)"); return false; } @@ -1984,10 +1893,8 @@ void final_cleanup (void) while (input_ptr > 0) { - if (state == 0) - { + if (state == token_list) end_token_list(); - } else end_file_reading(); } @@ -2012,7 +1919,7 @@ void final_cleanup (void) print_nl("("); print_esc("end occurred "); prints("when "); - print_cmd_chr('i', cur_if); + print_cmd_chr(if_test, cur_if); if (if_line != 0) { @@ -2021,7 +1928,7 @@ void final_cleanup (void) } prints(" was incomplete)"); - if_line = mem[cond_ptr + 1].cint; + if_line = if_line_field(cond_ptr); cur_if = subtype(cond_ptr); temp_ptr = cond_ptr; cond_ptr = link(cond_ptr); @@ -2043,14 +1950,13 @@ void final_cleanup (void) if (is_initex) { for (c = 0; c <= 4; c++) - { if (cur_mark[c] != 0) delete_token_ref(cur_mark[c]); - } if (last_glue != max_halfword) delete_glue_ref(last_glue); - store_fmt_file(); // returns a value ? + + store_fmt_file(); } #endif @@ -2061,10 +1967,9 @@ void final_cleanup (void) void show_frozen (void) { - int i, j, n; + int i; - fprintf(log_file, "\n"); - fprintf(log_file, "(%lld fonts frozen in format file:\n", font_ptr); + fprintf(log_file, "\n(%lld fonts frozen in format file:\n", font_ptr); for (i = 1; i <= font_ptr; i++) { @@ -2074,12 +1979,7 @@ void show_frozen (void) if ((i % 8) == 0) fprintf(log_file, "\n"); - n = str_start[font_name[i] + 1] - str_start[font_name[i]]; - - for (j = 0; j < n; j++) - { - putc(str_pool[str_start[font_name[i]] + j], log_file); - } + fwrite(&str_pool[str_start[font_name[i]]], 1, length(font_name[i]), log_file); } fprintf(log_file, ") "); @@ -2090,7 +1990,7 @@ int main_program (void) history = fatal_error_stop; if (ready_already == 314159L) - goto lab1; + goto start_of_TEX; bad = 0; @@ -2194,27 +2094,27 @@ int main_program (void) ready_already = 314159L; -lab1: +start_of_TEX: selector = term_only; tally = 0; term_offset = 0; file_offset = 0; - show_line(tex_version, 0); - -#ifdef _WIN32 - #ifdef _WIN64 - printf(" (%s %s/Win64)", application, yandyversion); - #else - printf(" (%s %s/Win32)", application, yandyversion); - #endif -#else - printf(" (%s %s/Linux)", application, yandyversion); -#endif - if (format_ident > 0) + print_banner(); + + if (format_ident == 0) + { + prints(" (preloaded format="); + prints(format_name); + prints(")"); + print_ln(); + } + else + { slow_print(format_ident); + print_ln(); + } - print_ln(); update_terminal(); job_name = 0; name_in_progress = false; @@ -2258,16 +2158,15 @@ lab1: first = last + 1; } - if ((format_ident == 0) || (buffer[loc] == '&') || - (buffer[loc] == '+')) + if ((format_ident == 0) || (buffer[loc] == '&') || (buffer[loc] == '+')) { if (format_ident != 0) initialize(); - if (!open_fmt_file ()) + if (!open_fmt_file()) goto final_end; - if (!load_fmt_file ()) + if (!load_fmt_file()) { #ifdef COMPACTFORMAT gzclose(gz_fmt_file); @@ -2325,13 +2224,10 @@ final_end: { int code; -#ifndef _WINDOWS - fflush(stdout); -#endif - + update_terminal(); ready_already = 0; - if ((history != 0) && (history != 1)) + if ((history != spotless) && (history != warning_issued)) code = 1; else code = 0; @@ -2383,7 +2279,7 @@ void reset_trie (void) { integer k; - for (k = -(integer)trie_op_size; k <= trie_op_size; k++) + for (k = -(integer) trie_op_size; k <= trie_op_size; k++) trie_op_hash[k] = 0; for (k = 0; k <= 255; k++) @@ -2413,9 +2309,9 @@ void reset_hyphen(void) /* split out to allow optimize for space, not time */ void do_initex (void) { -/* integer i; */ + /* integer i; */ integer k; -/* hyph_pointer z; */ + /* hyph_pointer z; */ for (k = mem_bot + 1; k <= lo_mem_stat_max; k++) mem[k].cint = 0; @@ -2567,7 +2463,7 @@ void do_initex (void) puts("initex cs_count = 0 "); eq_type(frozen_dont_expand) = dont_expand; - text(frozen_dont_expand) = 499; /* notexpanded */ + text(frozen_dont_expand) = 499; /* "notexpanded:" */ font_ptr = null_font; fmem_ptr = 7; @@ -2599,8 +2495,8 @@ void do_initex (void) reset_trie(); text(frozen_protection) = 1184; /* "inaccessible" */ - format_ident = 1251; - text(end_write) = 1290; + format_ident = 1251; /* " (INITEX)" */ + text(end_write) = 1290; /* "endwrite" */ eq_level(end_write) = level_one; eq_type(end_write) = outer_call; equiv(end_write) = 0; @@ -2645,7 +2541,7 @@ boolean get_strings_started (void) if (g == 0) { - fprintf(stdout , "%s\n", "! You have to increase POOLSIZE." ); + printf("%s\n", "! You have to increase POOLSIZE." ); return false; } @@ -2660,7 +2556,7 @@ void sort_avail (void) pointer p, q, r; pointer old_rover; - p = get_node(1073741824L); /* 2^30 merge adjacent free nodes */ + p = get_node(010000000000); p = rlink(rover); rlink(rover) = empty_flag; old_rover = rover; @@ -2707,7 +2603,7 @@ void primitive_ (str_number s, quarterword c, halfword o) { pool_pointer k; small_number j; -/* small_number l; */ + /* small_number l; */ int l; if (s < 256) @@ -2715,7 +2611,7 @@ void primitive_ (str_number s, quarterword c, halfword o) else { k = str_start[s]; - l = str_start[s + 1] - k; /* small_number l */ + l = str_start[s + 1] - k; for (j = 0; j <= l - 1; j++) buffer[j] = str_pool[k + j]; @@ -2733,7 +2629,7 @@ void primitive_ (str_number s, quarterword c, halfword o) #ifdef INITEX /* sec 0944 */ -trie_op_code new_trie_op_ (small_number d, small_number n, trie_op_code v) +trie_op_code new_trie_op (small_number d, small_number n, trie_op_code v) { integer h; trie_op_code u; @@ -2777,7 +2673,7 @@ trie_op_code new_trie_op_ (small_number d, small_number n, trie_op_code v) return u; } - if ((hyf_distance[l]== d) && (hyf_num[l]== n) && (hyf_next[l]== v) && (trie_op_lang[l]== cur_lang)) + if ((hyf_distance[l] == d) && (hyf_num[l] == n) && (hyf_next[l] == v) && (trie_op_lang[l] == cur_lang)) { return trie_op_val[l]; } @@ -2789,7 +2685,7 @@ trie_op_code new_trie_op_ (small_number d, small_number n, trie_op_code v) } } /* sec 0948 */ -trie_pointer trie_node_ (trie_pointer p) +trie_pointer trie_node (trie_pointer p) { trie_pointer h; trie_pointer q; @@ -2821,7 +2717,7 @@ trie_pointer trie_node_ (trie_pointer p) } } /* sec 0949 */ -trie_pointer compress_trie_ (trie_pointer p) +trie_pointer compress_trie (trie_pointer p) { if (p == 0) return 0; @@ -2829,11 +2725,12 @@ trie_pointer compress_trie_ (trie_pointer p) { trie_l[p] = compress_trie(trie_l[p]); trie_r[p] = compress_trie(trie_r[p]); + return trie_node(p); } } /* sec 0953 */ -void first_fit_ (trie_pointer p) +void first_fit (trie_pointer p) { trie_pointer h; trie_pointer z; @@ -2854,7 +2751,6 @@ void first_fit_ (trie_pointer p) if (trie_size <= h + 256) { overflow("pattern memory", trie_size); -/* not dynamic ---- but can be set -h=... from command line in ini-TeX */ return; } @@ -2882,11 +2778,13 @@ void first_fit_ (trie_pointer p) } goto found; + not_found: z = trie_trl[z]; } + found: - trie_taken[h] = true; /* h may be used without ... */ + trie_taken[h] = true; trie_hash[p] = h; q = p; @@ -2919,7 +2817,7 @@ found: while (!(q == 0)); } /* sec 0957 */ -void trie_pack_ (trie_pointer p) +void trie_pack (trie_pointer p) { trie_pointer q; @@ -2938,7 +2836,7 @@ void trie_pack_ (trie_pointer p) while (!(p == 0)); } /* sec 0959 */ -void trie_fix_ (trie_pointer p) +void trie_fix (trie_pointer p) { trie_pointer q; ASCII_code c; @@ -2964,43 +2862,40 @@ void trie_fix_ (trie_pointer p) /* sec 0960 */ void new_patterns (void) { -/* ******************************************************************* */ -/* was small_number k, l; in 3.141 */ char k, l; -/* ******************************************************************* */ - boolean digitsensed; + boolean digit_sensed; trie_op_code v; trie_pointer p, q; - boolean firstchild; -/* ASCII_code c; */ - int c; /* 95/Jan/7 */ + boolean first_child; + /* ASCII_code c; */ + int c; - if (!trie_not_ready) /* new stuff */ + if (!trie_not_ready) { if (allow_patterns) { if (trace_flag) - puts("Resetting patterns\n"); + puts("Resetting patterns"); - reset_trie(); /* RESET PATTERNS - 93/Nov/26 */ + reset_trie(); if (reset_exceptions) { if (trace_flag) - puts("Resetting exceptions\n"); + puts("Resetting exceptions"); - reset_hyphen(); /* RESET HYPHENEXCEPTIONS - 93/Nov/26 */ + reset_hyphen(); } } } -/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */ + if (trie_not_ready) { set_cur_lang(); scan_left_brace(); k = 0; hyf[0] = 0; - digitsensed = false; + digit_sensed = false; while (true) { @@ -3010,7 +2905,7 @@ void new_patterns (void) { case letter: case other_char: - if (digitsensed || (cur_chr < '0') || (cur_chr > '9')) + if (digit_sensed || (cur_chr < '0') || (cur_chr > '9')) { if (cur_chr == '.') cur_chr = 0; @@ -3031,13 +2926,13 @@ void new_patterns (void) incr(k); hc[k] = cur_chr; hyf[k] = 0; - digitsensed = false; + digit_sensed = false; } } else if (k < 63) { hyf[k] = cur_chr - '0'; - digitsensed = true; + digit_sensed = true; } break; case spacer: @@ -3054,7 +2949,8 @@ void new_patterns (void) l = k; v = min_trie_op; - while (true) { + while (true) + { if (hyf[l]!= 0) v = new_trie_op(k - l, hyf[l], v); @@ -3067,24 +2963,25 @@ done1: q = 0; hc[0] = cur_lang; - while (l <= k) { + while (l <= k) + { c = hc[l]; incr(l); p = trie_l[q]; - firstchild = true; + first_child = true; - while ((p > 0) && (c > trie_c[p])) { + while ((p > 0) && (c > trie_c[p])) + { q = p; p = trie_r[q]; - firstchild = false; + first_child = false; } if ((p == 0) || (c < trie_c[p])) { if (trie_ptr == trie_size) { - overflow("pattern memory", trie_size); /* pattern memory - NOT DYNAMIC */ -/* not dynamic ---- but can be set -h=... from command line in ini-TeX */ + overflow("pattern memory", trie_size); return; } @@ -3093,25 +2990,26 @@ done1: p = trie_ptr; trie_l[p] = 0; - if (firstchild) - trie_l[q]= p; + if (first_child) + trie_l[q] = p; else - trie_r[q]= p; + trie_r[q] = p; trie_c[p] = c; trie_o[p] = min_trie_op; } + q = p; } - if (trie_o[q]!= min_trie_op) + if (trie_o[q] != min_trie_op) { print_err("Duplicate pattern"); help1("(See Appendix H.)"); error(); } - trie_o[q]= v; + trie_o[q] = v; } if (cur_cmd == right_brace) @@ -3119,7 +3017,7 @@ done1: k = 0; hyf[0] = 0; - digitsensed = false; + digit_sensed = false; } break; default: @@ -3148,22 +3046,18 @@ done:; void init_trie (void) { trie_pointer p; -/* integer j, k, t; */ + /* integer j, k, t; */ integer j, k; - int t; /* 95/Jan/7 */ + int t; trie_pointer r, s; op_start[0] = - (integer) min_trie_op; for (j = 1; j <= 255; j++) - { op_start[j] = op_start[j - 1] + trie_used[j - 1]; - } for (j = 1; j <= trie_op_ptr; j++) - { trie_op_hash[j] = op_start[trie_op_lang[j]] + trie_op_val[j]; - } for (j = 1; j <= trie_op_ptr; j++) { @@ -3185,21 +3079,15 @@ void init_trie (void) } for (p = 0; p <= trie_size; p++) - { trie_hash[p] = 0; - } trie_l[0] = compress_trie(trie_l[0]); for (p = 0; p <= trie_ptr; p++) - { - trie_hash[p]= 0; - } + trie_hash[p] = 0; for (p = 0; p <= 255; p++) - { trie_min[p] = p + 1; - } trie_trl[0] = 1; trie_max = 0; @@ -3218,6 +3106,7 @@ void init_trie (void) trie_tro[r] = min_trie_op; trie_trc[r] = 0; } + trie_max = 256; } else @@ -3228,6 +3117,7 @@ void init_trie (void) do { s = trie_trl[r]; + { trie_trl[r] = 0; trie_tro[r] = min_trie_op; @@ -3254,10 +3144,10 @@ void store_fmt_file (void) if (!is_initex) { - puts("! \\dump is performed only by INITEX\n"); + puts("! \\dump is performed only by INITEX"); if (!knuth_flag) - puts(" (Use -i on the command line)\n"); + puts(" (Use -i on the command line)"); return; } @@ -3270,7 +3160,7 @@ void store_fmt_file (void) } selector = new_string; - prints(" (format="); + prints(" (preloaded format="); print(job_name); print_char(' '); print_int(year); @@ -3280,7 +3170,7 @@ void store_fmt_file (void) print_int(day); print_char(')'); - if (interaction == 0) + if (interaction == batch_mode) selector = log_only; else selector = term_and_log; @@ -3290,9 +3180,7 @@ void store_fmt_file (void) pack_job_name(".fmt"); while (!w_open_out(fmt_file)) - { prompt_file_name("format file name", ".fmt"); - } print_nl("Beginning to dump on file "); slow_print(w_make_name_string(fmt_file)); @@ -3308,13 +3196,8 @@ void store_fmt_file (void) dump_int(hyphen_prime); dump_int(pool_ptr); dump_int(str_ptr); - - if (dumpthings(str_start[0], str_ptr + 1)) - return; - - if (dumpthings(str_pool[0], pool_ptr)) - return; - + dumpthings(str_start[0], str_ptr + 1); + dumpthings(str_pool[0], pool_ptr); print_ln(); print_int(str_ptr); prints(" strings of total length "); @@ -3359,7 +3242,7 @@ void store_fmt_file (void) while (p != 0) { decr(dyn_used); - p = mem[p].hh.rh; + p = link(p); } dump_int(var_used); @@ -3383,22 +3266,27 @@ void store_fmt_file (void) (eq_type(j) == eq_type(j + 1)) && (eq_level(j) == eq_level(j + 1))) goto found1; + incr(j); } l = (int_base); goto done1; + found1: incr(j); l = j; + while (j < (int_base - 1)) { if ((equiv(j) != equiv(j + 1)) || (eq_type(j) != eq_type(j + 1)) || (eq_level(j) != eq_level(j + 1))) goto done1; + incr(j); } + done1: dump_int(l - k); @@ -3418,11 +3306,13 @@ done1: { if (eqtb[j].cint == eqtb[j + 1].cint) goto found2; + incr(j); } l = (eqtb_size + 1); goto done2; + found2: incr(j); l = j; @@ -3431,8 +3321,10 @@ found2: { if (eqtb[j].cint != eqtb[j + 1].cint) goto done2; + incr(j); } + done2: dump_int(l - k); @@ -3451,7 +3343,7 @@ done2: cs_count = frozen_control_sequence - 1 - hash_used; if (trace_flag) - printf("itex cs_count %lld hash_size %d hash_extra %d hash_used %ld", + printf("itex cs_count %lld hash_size %d hash_extra %d hash_used %d", cs_count, hash_size, hash_extra, hash_used); for (p = hash_base; p <= hash_used; p++) @@ -3463,7 +3355,7 @@ done2: incr(cs_count); if (trace_flag) - puts("itex cs_count++ "); + puts("itex.c store_fmt_file() cs_count++ "); } } @@ -3478,79 +3370,31 @@ done2: dump_int(fmem_ptr); { - if (dumpthings(font_info[0], fmem_ptr)) - return; - + dumpthings(font_info[0], fmem_ptr); dump_int(font_ptr); - - if (dumpthings(font_check[0], font_ptr + 1)) - return; - - if (dumpthings(font_size[0], font_ptr + 1)) - return; - - if (dumpthings(font_dsize[0], font_ptr + 1)) - return; - - if (dumpthings(font_params[0], font_ptr + 1)) - return; - - if (dumpthings(hyphen_char[0], font_ptr + 1)) - return; - - if (dumpthings(skew_char[0], font_ptr + 1)) - return; - - if (dumpthings(font_name[0], font_ptr + 1)) - return; - - if (dumpthings(font_area[0], font_ptr + 1)) - return; - - if (dumpthings(font_bc[0], font_ptr + 1)) - return; - - if (dumpthings(font_ec[0], font_ptr + 1)) - return; - - if (dumpthings(char_base[0], font_ptr + 1)) - return; - - if (dumpthings(width_base[0], font_ptr + 1)) - return; - - if (dumpthings(height_base[0], font_ptr + 1)) - return; - - if (dumpthings(depth_base[0], font_ptr + 1)) - return; - - if (dumpthings(italic_base[0], font_ptr + 1)) - return; - - if (dumpthings(lig_kern_base[0], font_ptr + 1)) - return; - - if (dumpthings(kern_base[0], font_ptr + 1)) - return; - - if (dumpthings(exten_base[0], font_ptr + 1)) - return; - - if (dumpthings(param_base[0], font_ptr + 1)) - return; - - if (dumpthings(font_glue[0], font_ptr + 1)) - return; - - if (dumpthings(bchar_label[0], font_ptr + 1)) - return; - - if (dumpthings(font_bchar[0], font_ptr + 1)) - return; - - if (dumpthings(font_false_bchar[0], font_ptr + 1)) - return; + dumpthings(font_check[0], font_ptr + 1); + dumpthings(font_size[0], font_ptr + 1); + dumpthings(font_dsize[0], font_ptr + 1); + dumpthings(font_params[0], font_ptr + 1); + dumpthings(hyphen_char[0], font_ptr + 1); + dumpthings(skew_char[0], font_ptr + 1); + dumpthings(font_name[0], font_ptr + 1); + dumpthings(font_area[0], font_ptr + 1); + dumpthings(font_bc[0], font_ptr + 1); + dumpthings(font_ec[0], font_ptr + 1); + dumpthings(char_base[0], font_ptr + 1); + dumpthings(width_base[0], font_ptr + 1); + dumpthings(height_base[0], font_ptr + 1); + dumpthings(depth_base[0], font_ptr + 1); + dumpthings(italic_base[0], font_ptr + 1); + dumpthings(lig_kern_base[0], font_ptr + 1); + dumpthings(kern_base[0], font_ptr + 1); + dumpthings(exten_base[0], font_ptr + 1); + dumpthings(param_base[0], font_ptr + 1); + dumpthings(font_glue[0], font_ptr + 1); + dumpthings(bchar_label[0], font_ptr + 1); + dumpthings(font_bchar[0], font_ptr + 1); + dumpthings(font_false_bchar[0], font_ptr + 1); for (k = 0; k <= font_ptr; k++) { @@ -3572,17 +3416,17 @@ done2: print_ln(); print_int(fmem_ptr - 7); prints(" words of font info for "); - print_int(font_ptr - 0); + print_int(font_ptr - font_base); prints(" preloaded font"); - if (font_ptr != 1) + if (font_ptr != font_base + 1) print_char('s'); dump_int(hyph_count); for (k = 0; k <= hyphen_prime; k++) { - if (hyph_word[k]!= 0) + if (hyph_word[k] != 0) { dump_int(k); dump_int(hyph_word[k]); @@ -3601,27 +3445,13 @@ done2: init_trie(); dump_int(trie_max); - - if (dumpthings(trie_trl[0], trie_max + 1)) - return; - - if (dumpthings(trie_tro[0], trie_max + 1)) - return; - - if (dumpthings(trie_trc[0], trie_max + 1)) - return; - + dumpthings(trie_trl[0], trie_max + 1); + dumpthings(trie_tro[0], trie_max + 1); + dumpthings(trie_trc[0], trie_max + 1); dump_int(trie_op_ptr); - - if (dumpthings(hyf_distance[1], trie_op_ptr)) - return; - - if (dumpthings(hyf_num[1], trie_op_ptr)) - return; - - if (dumpthings(hyf_next[1], trie_op_ptr)) - return; - + dumpthings(hyf_distance[1], trie_op_ptr); + dumpthings(hyf_num[1], trie_op_ptr); + dumpthings(hyf_next[1], trie_op_ptr); print_nl("Hyphenation trie of length "); print_int(trie_max); prints(" has "); @@ -3653,7 +3483,7 @@ done2: tracing_stats = 0; #ifdef COMPACTFORMAT - gzclose(gz_fmt_file); + gz_w_close(gz_fmt_file); #else w_close(fmt_file); #endif @@ -3824,63 +3654,63 @@ void init_prim (void) par_token = cs_token_flag + par_loc; primitive("input", input, 0); primitive("endinput", input, 1); - primitive("topmark", top_bot_mark, 0); - primitive("firstmark", top_bot_mark, 1); - primitive("botmark", top_bot_mark, 2); - primitive("splitfirstmark", top_bot_mark, 3); - primitive("splitbotmark", top_bot_mark, 4); - primitive("count", tex_register, 0); - primitive("dimen", tex_register, 1); - primitive("skip", tex_register, 2); - primitive("muskip", tex_register, 3); - primitive("spacefactor", set_aux, 102); - primitive("prevdepth", set_aux, 1); + primitive("topmark", top_bot_mark, top_mark_code); + primitive("firstmark", top_bot_mark, first_mark_code); + primitive("botmark", top_bot_mark, bot_mark_code); + primitive("splitfirstmark", top_bot_mark, split_first_mark_code); + primitive("splitbotmark", top_bot_mark, split_bot_mark_code); + primitive("count", tex_register, int_val); + primitive("dimen", tex_register, dimen_val); + primitive("skip", tex_register, glue_val); + primitive("muskip", tex_register, mu_val); + primitive("spacefactor", set_aux, hmode); + primitive("prevdepth", set_aux, vmode); primitive("deadcycles", set_page_int, 0); primitive("insertpenalties", set_page_int, 1); - primitive("wd", set_box_dimen, 1); - primitive("ht", set_box_dimen, 3); - primitive("dp", set_box_dimen, 2); - primitive("lastpenalty", last_item, 0); - primitive("lastkern", last_item, 1); - primitive("lastskip", last_item, 2); - primitive("inputlineno", last_item, 3); - primitive("badness", last_item, 4); - primitive("number", convert, 0); - primitive("romannumeral", convert, 1); - primitive("string", convert, 2); - primitive("meaning", convert, 3); - primitive("fontname", convert, 4); - primitive("jobname", convert, 5); - primitive("if", if_test, 0); - primitive("ifcat", if_test, 1); - primitive("ifnum", if_test, 2); - primitive("ifdim", if_test, 3); - primitive("ifodd", if_test, 4); - primitive("ifvmode", if_test, 5); - primitive("ifhmode", if_test, 6); - primitive("ifmmode", if_test, 7); - primitive("ifinner", if_test, 8); - primitive("ifvoid", if_test, 9); - primitive("ifhbox", if_test, 10); - primitive("ifvbox", if_test, 11); - primitive("ifx", if_test, 12); - primitive("ifeof", if_test, 13); - primitive("iftrue", if_test, 14); - primitive("iffalse", if_test, 15); - primitive("ifcase", if_test, 16); - primitive("fi", fi_or_else, 2); + primitive("wd", set_box_dimen, width_offset); + primitive("ht", set_box_dimen, height_offset); + primitive("dp", set_box_dimen, depth_offset); + primitive("lastpenalty", last_item, int_val); + primitive("lastkern", last_item, dimen_val); + primitive("lastskip", last_item, glue_val); + primitive("inputlineno", last_item, input_line_no_code); + primitive("badness", last_item, badness_code); + primitive("number", convert, number_code); + primitive("romannumeral", convert, roman_numeral_code); + primitive("string", convert, string_code); + primitive("meaning", convert, meaning_code); + primitive("fontname", convert, font_name_code); + primitive("jobname", convert, job_name_code); + primitive("if", if_test, if_char_code); + primitive("ifcat", if_test, if_cat_code); + primitive("ifnum", if_test, if_int_code); + primitive("ifdim", if_test, if_dim_code); + primitive("ifodd", if_test, if_odd_code); + primitive("ifvmode", if_test, if_vmode_code); + primitive("ifhmode", if_test, if_hmode_code); + primitive("ifmmode", if_test, if_mmode_code); + primitive("ifinner", if_test, if_inner_code); + primitive("ifvoid", if_test, if_void_code); + primitive("ifhbox", if_test, if_hbox_code); + primitive("ifvbox", if_test, if_vbox_code); + primitive("ifx", if_test, ifx_code); + primitive("ifeof", if_test, if_eof_code); + primitive("iftrue", if_test, if_true_code); + primitive("iffalse", if_test, if_false_code); + primitive("ifcase", if_test, if_case_code); + primitive("fi", fi_or_else, fi_code); text(frozen_fi) = make_string_pool("fi"); eqtb[frozen_fi] = eqtb[cur_val]; - primitive("or", fi_or_else, 4); - primitive("else", fi_or_else, 3); - primitive("nullfont", set_font, 0); + primitive("or", fi_or_else, or_code); + primitive("else", fi_or_else, else_code); + primitive("nullfont", set_font, null_font); text(frozen_null_font) = 795; eqtb[frozen_null_font] = eqtb[cur_val]; - primitive("span", tab_mark, 256); - primitive("cr", car_ret, 257); + primitive("span", tab_mark, span_code); + primitive("cr", car_ret, cr_code); text(frozen_cr) = make_string_pool("cr"); eqtb[frozen_cr] = eqtb[cur_val]; - primitive("crcr", car_ret, 258); + primitive("crcr", car_ret, cr_cr_code); text(frozen_end_template) = make_string_pool("endtemplate"); text(frozen_endv) = make_string_pool("endtemplate"); eq_type(frozen_endv) = endv; @@ -3896,74 +3726,74 @@ void init_prim (void) primitive("pagefilllstretch", set_page_dimen, 5); primitive("pageshrink", set_page_dimen, 6); primitive("pagedepth", set_page_dimen, 7); - primitive("end", end_match, 0); + primitive("end", stop, 0); primitive("dump", stop, 1); - primitive("hskip", hskip, 4); - primitive("hfil", hskip, 0); - primitive("hfill", hskip, 1); - primitive("hss", hskip, 2); - primitive("hfilneg", hskip, 3); - primitive("vskip", vskip, 4); - primitive("vfil", vskip, 0); - primitive("vfill", vskip, 1); - primitive("vss", vskip, 2); - primitive("vfilneg", vskip, 3); - primitive("mskip", mskip, 5); - primitive("kern", kern, 1); - primitive("mkern", mkern, 99); + primitive("hskip", hskip, skip_code); + primitive("hfil", hskip, fil_code); + primitive("hfill", hskip, fill_code); + primitive("hss", hskip, ss_code); + primitive("hfilneg", hskip, fil_neg_code); + primitive("vskip", vskip, skip_code); + primitive("vfil", vskip, fil_code); + primitive("vfill", vskip, fill_code); + primitive("vss", vskip, ss_code); + primitive("vfilneg", vskip, fil_neg_code); + primitive("mskip", mskip, mskip_code); + primitive("kern", kern, explicit); + primitive("mkern", mkern, mu_glue); primitive("moveleft", hmove, 1); primitive("moveright", hmove, 0); primitive("raise", vmove, 1); primitive("lower", vmove, 0); - primitive("box", make_box, 0); - primitive("copy", make_box, 1); - primitive("lastbox", make_box, 2); - primitive("vsplit", make_box, 3); - primitive("vtop", make_box, 4); - primitive("vbox", make_box, 5); - primitive("hbox", make_box, 106); - primitive("shipout", leader_ship, 99); - primitive("leaders", leader_ship, 100); - primitive("cleaders", leader_ship, 101); - primitive("xleaders", leader_ship, 102); + primitive("box", make_box, box_code); + primitive("copy", make_box, copy_code); + primitive("lastbox", make_box, last_box_code); + primitive("vsplit", make_box, vsplit_code); + primitive("vtop", make_box, vtop_code); + primitive("vbox", make_box, vtop_code + vmode); + primitive("hbox", make_box, vtop_code + hmode); + primitive("shipout", leader_ship, a_leaders - 1); + primitive("leaders", leader_ship, a_leaders); + primitive("cleaders", leader_ship, c_leaders); + primitive("xleaders", leader_ship, x_leaders); primitive("indent", start_par, 1); primitive("noindent", start_par, 0); - primitive("unpenalty", remove_item, 12); - primitive("unkern", remove_item, 11); - primitive("unskip", remove_item, 10); - primitive("unhbox", un_hbox, 0); - primitive("unhcopy", un_hbox, 1); - primitive("unvbox", un_vbox, 0); - primitive("unvcopy", un_vbox, 1); + primitive("unpenalty", remove_item, penalty_node); + primitive("unkern", remove_item, kern_node); + primitive("unskip", remove_item, glue_node); + primitive("unhbox", un_hbox, box_code); + primitive("unhcopy", un_hbox, copy_code); + primitive("unvbox", un_vbox, box_code); + primitive("unvcopy", un_vbox, copy_code); primitive("-", discretionary, 1); primitive("discretionary", discretionary, 0); primitive("eqno", eq_no, 0); primitive("leqno", eq_no, 1); - primitive("mathord", math_comp, 16); - primitive("mathop", math_comp, 17); - primitive("mathbin", math_comp, 18); - primitive("mathrel", math_comp, 19); - primitive("mathopen", math_comp, 20); - primitive("mathclose", math_comp, 21); - primitive("mathpunct", math_comp, 22); - primitive("mathinner", math_comp, 23); - primitive("underline", math_comp, 26); - primitive("overline", math_comp, 27); - primitive("displaylimits", limit_switch, 0); - primitive("limits", limit_switch, 1); - primitive("nolimits", limit_switch, 2); - primitive("displaystyle", math_style, 0); - primitive("textstyle", math_style, 2); - primitive("scriptstyle", math_style, 4); - primitive("scriptscriptstyle", math_style, 6); - primitive("above", above, 0); - primitive("over", above, 1); - primitive("atop", above, 2); - primitive("abovewithdelims", above, 3); - primitive("overwithdelims", above, 4); - primitive("atopwithdelims", above, 5); - primitive("left", left_right, 30); - primitive("right", left_right, 31); + primitive("mathord", math_comp, ord_noad); + primitive("mathop", math_comp, op_noad); + primitive("mathbin", math_comp, bin_noad); + primitive("mathrel", math_comp, rel_noad); + primitive("mathopen", math_comp, open_noad); + primitive("mathclose", math_comp, close_noad); + primitive("mathpunct", math_comp, punct_noad); + primitive("mathinner", math_comp, inner_noad); + primitive("underline", math_comp, under_noad); + primitive("overline", math_comp, over_noad); + primitive("displaylimits", limit_switch, normal); + primitive("limits", limit_switch, limits); + primitive("nolimits", limit_switch, no_limits); + primitive("displaystyle", math_style, display_style); + primitive("textstyle", math_style, text_style); + primitive("scriptstyle", math_style, script_style); + primitive("scriptscriptstyle", math_style, script_script_style); + primitive("above", above, above_code); + primitive("over", above, over_code); + primitive("atop", above, atop_code); + primitive("abovewithdelims", above, delimited_code + above_code); + primitive("overwithdelims", above, delimited_code + over_code); + primitive("atopwithdelims", above, delimited_code + atop_code); + primitive("left", left_right, left_noad); + primitive("right", left_right, right_noad); text(frozen_right) = make_string_pool("right"); eqtb[frozen_right] = eqtb[cur_val]; primitive("long", prefix, 1); @@ -3973,15 +3803,15 @@ void init_prim (void) primitive("gdef", def, 1); primitive("edef", def, 2); primitive("xdef", def, 3); - primitive("let", let, 0); - primitive("futurelet", let, 1); - primitive("chardef", shorthand_def, 0); - primitive("mathchardef", shorthand_def, 1); - primitive("countdef", shorthand_def, 2); - primitive("dimendef", shorthand_def, 3); - primitive("skipdef", shorthand_def, 4); - primitive("muskipdef", shorthand_def, 5); - primitive("toksdef", shorthand_def, 6); + primitive("let", let, normal); + primitive("futurelet", let, normal + 1); + primitive("chardef", shorthand_def, char_def_code); + primitive("mathchardef", shorthand_def, math_char_def_code); + primitive("countdef", shorthand_def, count_def_code); + primitive("dimendef", shorthand_def, dimen_def_code); + primitive("skipdef", shorthand_def, skip_def_code); + primitive("muskipdef", shorthand_def, mu_skip_def_code); + primitive("toksdef", shorthand_def, toks_def_code); primitive("catcode", def_code, cat_code_base); primitive("mathcode", def_code, math_code_base); primitive("lccode", def_code, lc_code_base); @@ -3995,27 +3825,27 @@ void init_prim (void) primitive("patterns", hyph_data, 1); primitive("hyphenchar", assign_font_int, 0); primitive("skewchar", assign_font_int, 1); - primitive("batchmode", set_interaction, 0); - primitive("nonstopmode", set_interaction, 1); - primitive("scrollmode", set_interaction, 2); - primitive("errorstopmode", set_interaction, 3); + primitive("batchmode", set_interaction, batch_mode); + primitive("nonstopmode", set_interaction, nonstop_mode); + primitive("scrollmode", set_interaction, scroll_mode); + primitive("errorstopmode", set_interaction, error_stop_mode); primitive("openin", in_stream, 1); primitive("closein", in_stream, 0); primitive("message", message, 0); primitive("errmessage", message, 1); primitive("lowercase", case_shift, lc_code_base); primitive("uppercase", case_shift, uc_code_base); - primitive("show", xray, 0); - primitive("showbox", xray, 1); - primitive("showthe", xray, 2); - primitive("showlists", xray, 3); - primitive("openout", extension, 0); - primitive("write", extension, 1); + primitive("show", xray, show_code); + primitive("showbox", xray, show_box_code); + primitive("showthe", xray, show_the_code); + primitive("showlists", xray, show_lists); + primitive("openout", extension, open_node); + primitive("write", extension, write_node); write_loc = cur_val; - primitive("closeout", extension, 2); - primitive("special", extension, 3); - primitive("immediate", extension, 4); - primitive("setlanguage", extension, 5); + primitive("closeout", extension, close_node); + primitive("special", extension, special_node); + primitive("immediate", extension, immediate_code); + primitive("setlanguage", extension, set_language_code); no_new_control_sequence = true; } -#endif \ No newline at end of file +#endif