From c6cb7284a77d1f4fd4adde82969610668b8e436d Mon Sep 17 00:00:00 2001 From: maqiyuan Date: Mon, 31 Mar 2014 00:13:26 +0800 Subject: [PATCH] code clean --- src/texsourc/openinou.c | 13 +- src/texsourc/tex1.c | 780 ++++++++++++++++++++++++++---------------------- src/texsourc/texd.h | 89 +++++- 3 files changed, 496 insertions(+), 386 deletions(-) diff --git a/src/texsourc/openinou.c b/src/texsourc/openinou.c index f5b6aba..339748f 100644 --- a/src/texsourc/openinou.c +++ b/src/texsourc/openinou.c @@ -227,9 +227,6 @@ bool open_input (FILE **f, path_constant_type path_index, char *fopen_mode) bool openable = false; #if defined (FUNNY_CORE_DUMP) && !defined (BibTeX) -/* This only applies if a preloaded TeX (or Metafont) is being made; - it allows for automatic creation of the core dump (typing ^ - requires manual intervention). */ if (path_index == TEXINPUTPATH && strncmp (name_of_file + 1, "HackyInputFileNameForCoreDump.tex", 33) == 0) funny_core_dump(); @@ -550,7 +547,7 @@ bool extensionirrelevantaux (char *base, char *suffix) if (t > s) ret = 0; /* last dot occurs in path - no extension */ else - ret = 1; /* last dot occurs in file name itself */ + ret = 1; /* last dot occurs in file name itself */ } else ret = 1; /* name not qualified and has dot */ @@ -700,12 +697,14 @@ bool open_output (FILE **f, char *fopen_mode) /* string temp_name = concat3 (temp_dir, "/", name_of_file + 1); */ string temp_name = concat3 (temp_dir, PATH_SEP_STRING, name_of_file + 1); #endif - if (deslash) unixify((char *) temp_name); /* deslashify 93/Dec/28 */ + if (deslash) + unixify((char *) temp_name); /* deslashify 93/Dec/28 */ /* If share_flag is non-zero and we are opening for reading use fsopen */ /* but we can assume this is opening here for *output* */ *f = fopen((char*)temp_name, fopen_mode); /* If this succeeded, change name_of_file accordingly. */ - if (*f) strcpy((char*) name_of_file + 1, (char *) temp_name); + if (*f) + strcpy((char*) name_of_file + 1, (char *) temp_name); #ifndef BUILDNAMEDIRECT free (temp_name); #endif @@ -756,4 +755,4 @@ bool open_output (FILE **f, char *fopen_mode) } /* #pragma optimize ("g",)*/ /* try and avoid compiler bug here */ -/* #pragma optimize ("", on) */ /* try and avoid compiler bug here */ +/* #pragma optimize ("", on) */ /* try and avoid compiler bug here */ \ No newline at end of file diff --git a/src/texsourc/tex1.c b/src/texsourc/tex1.c index d6fe127..b28ec60 100644 --- a/src/texsourc/tex1.c +++ b/src/texsourc/tex1.c @@ -72,7 +72,7 @@ void flush_node_list_(halfword p) free_avail(p); else { - switch (mem[p].hh.b0) + switch (type(p)) { case hlist_node: case vlist_node: @@ -101,20 +101,20 @@ void flush_node_list_(halfword p) { switch (subtype(p)) { - case 0: - free_node(p, 3); + case open_node: + free_node(p, open_node_size); break; - case 1: - case 3: + case write_node: + case special_node: { - delete_token_ref(mem[p + 1].hh.v.RH); - free_node(p, 2); + delete_token_ref(write_tokens(p)); + free_node(p, write_node_size); goto lab30; } break; - case 2: - case 4: - free_node(p, 2); + case close_node: + case set_language_code: + free_node(p, small_node_size); break; default: { @@ -154,63 +154,64 @@ void flush_node_list_(halfword p) case adjust_node: flush_node_list(adjust_ptr(p)); break; - case 14: + case style_node: { - free_node(p, 3); + free_node(p, style_node_size); goto lab30; } break; - case 15 : + case choice_node: { - flush_node_list(mem[p + 1].hh.v.LH); - flush_node_list(mem[p + 1].hh.v.RH); - flush_node_list(mem[p + 2].hh.v.LH); - flush_node_list(mem[p + 2].hh.v.RH); - free_node(p, 3); + flush_node_list(display_mlist(p)); + flush_node_list(text_mlist(p)); + flush_node_list(script_mlist(p)); + flush_node_list(script_script_mlist(p)); + free_node(p, style_node_size); goto lab30; } break; - case 16: - case 17: - case 18: - case 19: - case 20: - case 21: - case 22: - case 23: - case 24: - case 27: - case 26: - case 29: - case 28: + case ord_noad: + case op_noad: + case bin_noad: + case rel_noad: + case open_noad: + case close_noad: + case punct_noad: + case inner_noad: + case radical_noad: + case over_noad: + case under_noad: + case vcenter_noad: + case accent_noad: { - if (mem[p + 1].hh.v.RH >= 2) - flush_node_list(mem[p + 1].hh.v.LH); - if (mem[p + 2].hh.v.RH >= 2) - flush_node_list(mem[p + 2].hh.v.LH); - if (mem[p + 3].hh.v.RH >= 2) - flush_node_list(mem[p + 3].hh.v.LH); - if (mem[p].hh.b0 == 24) - free_node(p, 5); - else if (mem[p].hh.b0 == 28) - free_node(p, 5); + if (math_type(nucleus(p)) >= sub_box) + flush_node_list(info(nucleus(p))); + if (math_type(supscr(p)) >= sub_box) + flush_node_list(info(supscr(p))); + if (math_type(subscr(p)) >= sub_box) + flush_node_list(info(subscr(p))); + if (type(p) == radical_noad) + free_node(p, radical_noad_size); else - free_node(p, 4); + if (type(p) == accent_noad) + free_node(p, accent_noad_size); + else + free_node(p, noad_size); goto lab30; } break; - case 30: - case 31: + case left_noad: + case right_noad: { - free_node(p, 4); + free_node(p, noad_size); goto lab30; } break; - case 25: + case fraction_noad: { - flush_node_list(mem[p + 2].hh.v.LH); - flush_node_list(mem[p + 3].hh.v.LH); - free_node(p, 6); + flush_node_list(info(numerator(p))); + flush_node_list(info(denominator(p))); + free_node(p, fraction_noad_size); goto lab30; } break; @@ -221,7 +222,7 @@ void flush_node_list_(halfword p) } break; } - free_node(p, 2); + free_node(p, small_node_size); lab30:; } p = q; @@ -354,7 +355,7 @@ halfword copy_node_list_(halfword p) } while (words > 0) { decr(words); - mem[r + words]= mem[p + words]; /* r may be used without having ... */ + mem[r + words] = mem[p + words]; /* r may be used without having ... */ } mem[q].hh.v.RH = r; q = r; @@ -377,6 +378,7 @@ halfword copy_node_list_(halfword p) void print_mode_(integer m) { if (m > 0) + { switch (m /(101)) { case 0: @@ -389,22 +391,27 @@ void print_mode_(integer m) print_string("display math"); break; } + } else + { if (m == 0) print_string("no"); - else - switch ((- (integer) m)/(101)) + else { - case 0: - print_string("internal vertical"); - break; - case 1: - print_string("restricted horizontal"); - break; - case 2: - print_string("math"); - break; + switch ((- (integer) m)/(101)) + { + case 0: + print_string("internal vertical"); + break; + case 1: + print_string("restricted horizontal"); + break; + case 2: + print_string("math"); + break; + } } + } print_string(" mode"); } /* sec 0216 */ @@ -416,12 +423,14 @@ void push_nest (void) #ifdef ALLOCATEINPUTSTACK if (nest_ptr == current_nest_size) nest = realloc_nest_stack(increment_nest_size); - if (nest_ptr == current_nest_size) { /* check again after allocation */ + if (nest_ptr == current_nest_size) /* check again after allocation */ + { overflow("semantic nest size", current_nest_size); return; // abort_flag set } #else - if (nest_ptr == nest_size) { + if (nest_ptr == nest_size) + { overflow("semantic nest size", nest_size); /* semantic next size - not dynamic */ return; // abort_flag set } @@ -449,6 +458,7 @@ void show_activities (void) memory_word a; halfword q, r; integer t; + nest[nest_ptr]= cur_list; print_nl(" "); print_ln(); @@ -1254,20 +1264,22 @@ void print_cmd_chr_ (quarterword cmd, halfword chrcode) else print_esc("else"); break; - case 4: - if (chrcode == 256) /* pool size */ /* max_quarterword + 1 ? */ + case tab_mark: + if (chrcode == span_code) /* pool size */ /* max_quarterword + 1 ? */ print_esc("span"); - else { + else + { print_string("alignment tab character "); print(chrcode); } break; - case 5: - if (chrcode == 257) /* cr_code */ + case car_ret: + if (chrcode == cr_code) print_esc("cr"); - else print_esc("crcr"); + else + print_esc("crcr"); break; - case 81: + case set_page_dimen: switch (chrcode) { case 0: @@ -1296,24 +1308,25 @@ void print_cmd_chr_ (quarterword cmd, halfword chrcode) break; } break; - case 14: + case stop: if (chrcode == 1) print_esc("dump"); - else print_esc("end"); + else + print_esc("end"); break; - case 26: + case hskip: switch (chrcode) { - case 4: + case skip_code: print_esc("hskip"); break; - case 0: + case fil_code: print_esc("hfil"); break; - case 1: + case fill_code: print_esc("hfill"); break; - case 2: + case ss_code: print_esc("hss"); break; default: @@ -1321,19 +1334,19 @@ void print_cmd_chr_ (quarterword cmd, halfword chrcode) break; } break; - case 27: + case vskip: switch (chrcode) { - case 4: + case skip_code: print_esc("vskip"); break; - case 0: + case fil_code: print_esc("vfil"); break; - case 1: + case fill_code: print_esc("vfill"); break; - case 2: + case ss_code: print_esc("vss"); break; default: @@ -1341,44 +1354,46 @@ void print_cmd_chr_ (quarterword cmd, halfword chrcode) break; } break; - case 28: + case mskip: print_esc("mskip"); break; - case 29: + case kern: print_esc("kern"); break; - case 30: + case mkern: print_esc("mkern"); break; - case 21: + case hmove: if (chrcode == 1) print_esc("moveleft"); - else print_esc("moveright"); + else + print_esc("moveright"); break; - case 22: + case vmove: if (chrcode == 1) print_esc("raise"); - else print_esc("lower"); + else + print_esc("lower"); break; - case 20: + case make_box: switch (chrcode) { - case 0: + case box_code: print_esc("box"); break; - case 1: + case copy_code: print_esc("copy"); break; - case 2: + case last_box_code: print_esc("lastbox"); break; - case 3: + case vsplit_code: print_esc("vsplit"); break; - case 4: + case vtop_code: print_esc("vtop"); break; - case 5: + case vtop_code + vmode: print_esc("vbox"); break; default: @@ -1386,76 +1401,82 @@ void print_cmd_chr_ (quarterword cmd, halfword chrcode) break; } break; - case 31: - if (chrcode == 100) + case leader_ship: + if (chrcode == a_leaders) print_esc("leaders"); - else if (chrcode == 101) + else if (chrcode == c_leaders) print_esc("cleaders"); - else if (chrcode == 102) + else if (chrcode == x_leaders) print_esc("xleaders"); - else print_esc("shipout"); + else + print_esc("shipout"); break; - case 43: + case start_par: if (chrcode == 0) print_esc("noindent"); - else print_esc("indent"); + else + print_esc("indent"); break; - case 25: - if (chrcode == 10) + case remove_item: + if (chrcode == glue_node) print_esc("unskip"); - else if (chrcode == 11) + else if (chrcode == kern_node) print_esc("unkern"); - else print_esc("unpenalty"); + else + print_esc("unpenalty"); break; - case 23: - if (chrcode == 1) + case un_hbox: + if (chrcode == copy_code) print_esc("unhcopy"); - else print_esc("unhbox"); + else + print_esc("unhbox"); break; - case 24: - if (chrcode == 1) + case un_vbox: + if (chrcode == copy_code) print_esc("unvcopy"); - else print_esc("unvbox"); + else + print_esc("unvbox"); break; - case 47: + case discretionary: if (chrcode == 1) print_esc("-"); else print_esc("discretionary"); break; - case 48: + case eq_no: if (chrcode == 1) print_esc("leqno"); - else print_esc("eqno"); + else + print_esc("eqno"); break; - case 50: + case math_comp: switch (chrcode) { - case 16: + case ord_noad: print_esc("mathord"); break; - case 17: + case op_noad: print_esc("mathop"); break; - case 18: + case bin_noad: print_esc("mathbin"); break; - case 19: + case rel_noad: print_esc("mathrel"); break; - case 20: + case open_noad: print_esc("mathopen"); break; - case 21: + case close_noad: print_esc("mathclose"); break; - case 22: + case punct_noad: print_esc("mathpunct"); break; - case 23: + case inner_noad: print_esc("mathinner"); break; - case 26: + case under_noad: print_esc("underline"); break; default: @@ -1463,32 +1484,33 @@ void print_cmd_chr_ (quarterword cmd, halfword chrcode) break; } break; - case 51: - if (chrcode == 1) + case limit_switch: + if (chrcode == limits) print_esc("limits"); - else if (chrcode == 2) + else if (chrcode == no_limits) print_esc("nolimits"); - else print_esc("displaylimits"); + else + print_esc("displaylimits"); break; - case 53: + case math_style: print_style(chrcode); break; - case 52: + case above: switch (chrcode) { - case 1: + case over_code: print_esc("over"); break; - case 2: + case atop_code: print_esc("atop"); break; - case 3: + case delimited_code + above_code: print_esc("abovewithdelims"); break; - case 4: + case delimited_code + over_code: print_esc("overwithdelims"); break; - case 5: + case delimited_code + atop_code: print_esc("atopwithdelims"); break; default: @@ -1496,51 +1518,55 @@ void print_cmd_chr_ (quarterword cmd, halfword chrcode) break; } break; - case 49: - if (chrcode == 30) + case left_right: + if (chrcode == left_noad) print_esc("left"); - else print_esc("right"); + else + print_esc("right"); break; - case 93: + case prefix: if (chrcode == 1) print_esc("long"); else if (chrcode == 2) print_esc("outer"); - else print_esc("global"); + else + print_esc("global"); break; - case 97: + case def: if (chrcode == 0) print_esc("def"); else if (chrcode == 1) print_esc("gdef"); else if (chrcode == 2) print_esc("edef"); - else print_esc("xdef"); + else + print_esc("xdef"); break; - case 94: - if (chrcode != 0) + case let: + if (chrcode != normal) print_esc("futurelet"); - else print_esc("let"); + else + print_esc("let"); break; - case 95: + case shorthand_def: switch (chrcode) { - case 0: + case char_def_code: print_esc("chardef"); break; - case 1: + case math_char_def_code: print_esc("mathchardef"); break; - case 2: + case count_def_code: print_esc("countdef"); break; - case 3: + case dimen_def_code: print_esc("dimendef"); break; - case 4: + case skip_def_code: print_esc("skipdef"); break; - case 5: + case mu_skip_def_code: print_esc("muskipdef"); break; default: @@ -1548,15 +1574,15 @@ void print_cmd_chr_ (quarterword cmd, halfword chrcode) break; } break; - case 68: + case char_given: print_esc("char"); print_hex(chrcode); break; - case 69: + case math_given: print_esc("mathchar"); print_hex(chrcode); break; - case 85: + case def_code: if (chrcode == cat_code_base) print_esc("catcode"); else if (chrcode == math_code_base) @@ -1567,22 +1593,25 @@ void print_cmd_chr_ (quarterword cmd, halfword chrcode) print_esc("uccode"); else if (chrcode == sf_code_base) print_esc("sfcode"); - else print_esc("delcode"); + else + print_esc("delcode"); break; - case 86: + case def_family: print_size(chrcode - math_font_base); break; - case 99: + case hyph_data: if (chrcode == 1) print_esc("patterns"); - else print_esc("hyphenation"); + else + print_esc("hyphenation"); break; - case 78: + case assign_font_int: if (chrcode == 0) print_esc("hyphenchar"); - else print_esc("skewchar"); + else + print_esc("skewchar"); break; - case 87: + case set_font: print_string("select font "); slow_print(font_name[chrcode]); if (font_size[chrcode] != font_dsize[chrcode]) @@ -1592,16 +1621,16 @@ void print_cmd_chr_ (quarterword cmd, halfword chrcode) print_string("pt"); } break; - case 100: + case set_interaction: switch (chrcode) { - case 0: + case batch_mode: print_esc("batchmode"); break; - case 1: + case nonstop_mode: print_esc("nonstopmode"); break; - case 2: + case scroll_mode: print_esc("scrollmode"); break; default: @@ -1609,31 +1638,34 @@ void print_cmd_chr_ (quarterword cmd, halfword chrcode) break; } break; - case 60: + case in_stream: if (chrcode == 0) print_esc("closein"); - else print_esc("openin"); + else + print_esc("openin"); break; - case 58: + case message: if (chrcode == 0) print_esc("message"); - else print_esc("errmessage"); + else + print_esc("errmessage"); break; - case 57: + case case_shift: if (chrcode == lc_code_base) print_esc("lowercase"); - else print_esc("uppercase"); + else + print_esc("uppercase"); break; - case 19: + case xray: switch (chrcode) { - case 1: + case show_box_code: print_esc("showbox"); break; - case 2: + case show_the_code: print_esc("showthe"); break; - case 3: + case show_lists: print_esc("showlists"); break; default: @@ -1641,44 +1673,44 @@ void print_cmd_chr_ (quarterword cmd, halfword chrcode) break; } break; - case 101: + case undefined_cs: print_string("undefined"); break; - case 111: + case call: print_string("macro"); break; - case 112: + case long_call: print_esc("long macro"); break; - case 113: + case outer_call: print_esc("outer macro"); break; - case 114: + case long_outer_call: print_esc("long"); print_esc("outer macro"); break; - case 115: + case end_template: print_esc("outer endtemplate"); break; - case 59: + case extension: switch (chrcode) { - case 0: + case open_node: print_esc("openout"); break; - case 1: + case write_node: print_esc("write"); break; - case 2: + case close_node: print_esc("closeout"); break; - case 3: + case special_node: print_esc("special"); break; - case 4: + case immediate_code: print_esc("immediate"); break; - case 5: + case set_language_code: print_esc("setlanguage"); break; default: @@ -1697,165 +1729,183 @@ void show_eqtb_(halfword n) { if (n < active_base) print_char('?'); - else if (n < glue_base) - { - sprint_cs(n); - print_char('='); - print_cmd_chr(eq_type(n), equiv(n)); - if (eqtb[n].hh.b0 >= call) - { - print_char(':'); - show_token_list(link(equiv(n)), 0, 32); - } - } - else if (n < local_base) - if (n < skip_base) - { - print_skip_param(n - glue_base); - print_char('='); - if (n < glue_base + thin_mu_skip_code) - print_spec(equiv(n), "pt"); - else - print_spec(equiv(n), "mu"); - } - else if (n < mu_skip_base) - { - print_esc("skip"); - print_int(n - skip_base); - print_char('='); - print_spec(equiv(n), "pt"); - } - else - { - print_esc("muskip"); - print_int(n - mu_skip_base); - print_char('='); - print_spec(equiv(n), "mu"); - } - else if (n < int_base) - if (n == par_shape_loc) - { - print_esc("parshape"); - print_char('='); - if (par_shape_ptr == 0) - print_char('0'); - else - print_int(info(par_shape_ptr)); - } - else if (n < toks_base) - { - print_cmd_chr(assign_toks, n); - print_char('='); - if (equiv(n) != 0) - show_token_list(link(equiv(n)), 0, 32); - } - else if (n < box_base) - { - print_esc("toks"); - print_int(n - toks_base); - print_char('='); - if (equiv(n) != 0) - show_token_list(link(equiv(n)), 0, 32); - } - else if (n < cur_font_loc) + else + if (n < glue_base) { - print_esc("box"); - print_int(n - box_base); + sprint_cs(n); print_char('='); - if (equiv(n) == 0) - print_string("void"); - else + print_cmd_chr(eq_type(n), equiv(n)); + if (eqtb[n].hh.b0 >= call) { - depth_threshold = 0; - breadth_max = 1; - show_node_list(equiv(n)); + print_char(':'); + show_token_list(link(equiv(n)), 0, 32); } } - else if (n < cat_code_base) + else + if (n < local_base) + if (n < skip_base) + { + print_skip_param(n - glue_base); + print_char('='); + if (n < glue_base + thin_mu_skip_code) + print_spec(equiv(n), "pt"); + else + print_spec(equiv(n), "mu"); + } + else + if (n < mu_skip_base) + { + print_esc("skip"); + print_int(n - skip_base); + print_char('='); + print_spec(equiv(n), "pt"); + } + else + { + print_esc("muskip"); + print_int(n - mu_skip_base); + print_char('='); + print_spec(equiv(n), "mu"); + } + else + if (n < int_base) + if (n == par_shape_loc) + { + print_esc("parshape"); + print_char('='); + if (par_shape_ptr == 0) + print_char('0'); + else + print_int(info(par_shape_ptr)); + } + else + if (n < toks_base) + { + print_cmd_chr(assign_toks, n); + print_char('='); + if (equiv(n) != 0) + show_token_list(link(equiv(n)), 0, 32); + } + else + if (n < box_base) + { + print_esc("toks"); + print_int(n - toks_base); + print_char('='); + if (equiv(n) != 0) + show_token_list(link(equiv(n)), 0, 32); + } + else + if (n < cur_font_loc) + { + print_esc("box"); + print_int(n - box_base); + print_char('='); + if (equiv(n) == 0) + print_string("void"); + else + { + depth_threshold = 0; + breadth_max = 1; + show_node_list(equiv(n)); + } + } + else + if (n < cat_code_base) + { + if (n == cur_font_loc) + print_string("current font"); + else + if (n < math_font_base + 16) + { + print_esc("textfont"); + print_int(n - math_font_base); + } + else + if (n < math_font_base + 32) + { + print_esc("scriptfont"); + print_int(n - math_font_base - 16); + } + else + { + print_esc("scriptscriptfont"); + print_int(n - math_font_base - 32); + } + print_char('='); + print_esc(""); + print(hash[(hash_size + hash_extra + 524) + equiv(n)].v.RH); + } + else + if (n < math_code_base) + { + if (n < lc_code_base) + { + print_esc("catcode"); + print_int(n - cat_code_base); + } + else + if (n < uc_code_base) + { + print_esc("lccode"); + print_int(n - lc_code_base); + } + else + if (n < sf_code_base) + { + print_esc("uccode"); + print_int(n - uc_code_base); + } + else + { + print_esc("sfcode"); + print_int(n - sf_code_base); + } + print_char('='); + print_int(equiv(n)); + } + else + { + print_esc("mathcode"); + print_int(n - math_code_base); + print_char('='); + print_int(equiv(n)); + } + else + if (n < dimen_base) { - if (n == cur_font_loc) - print_string("current font"); - else if (n < math_font_base + 16) - { - print_esc("textfont"); - print_int(n - math_font_base); - } - else if (n < math_font_base + 32) - { - print_esc("scriptfont"); - print_int(n - math_font_base - 16); - } + if (n < count_base) + print_param(n - int_base); else - { - print_esc("scriptscriptfont"); - print_int(n - math_font_base - 32); - } - print_char('='); - print_esc(""); print(hash[(hash_size + hash_extra + 524) + equiv(n)].v.RH); + if (n < del_code_base) + { + print_esc("count"); + print_int(n - count_base); + } + else + { + print_esc("delcode"); + print_int(n - del_code_base); + } + print_char('='); + print_int(eqtb[n].cint); } - else if (n < math_code_base) - { - if (n < lc_code_base) - { - print_esc("catcode"); - print_int(n - cat_code_base); - } - else if (n < uc_code_base) - { - print_esc("lccode"); - print_int(n - lc_code_base); - } - else if (n < sf_code_base) + else + if (n <= eqtb_size) { - print_esc("uccode"); - print_int(n - uc_code_base); + if (n < scaled_base) + print_length_param(n - dimen_base); + else + { + print_esc("dimen"); + print_int(n - scaled_base); + } + print_char('='); + print_scaled(eqtb[n].cint); + print_string("pt"); } else - { - print_esc("sfcode"); - print_int(n - sf_code_base); - } - print_char('='); - print_int(equiv(n)); - } - else - { - print_esc("mathcode"); - print_int(n - math_code_base); - print_char('='); - print_int(equiv(n)); - } - else if (n < dimen_base) - { - if (n < count_base) - print_param(n - int_base); - else if (n < del_code_base) - { - print_esc("count"); - print_int(n - count_base); - } - else - { - print_esc("delcode"); - print_int(n - del_code_base); - } - print_char('='); - print_int(eqtb[n].cint); - } - else if (n <= eqtb_size) - { - if (n < scaled_base) - print_length_param(n - dimen_base); - else - { - print_esc("dimen"); - print_int(n - scaled_base); - } - print_char('='); - print_scaled(eqtb[n].cint); - print_string("pt"); - } - else print_char('?'); + print_char('?'); } #endif /* STAT */ @@ -1880,7 +1930,8 @@ halfword id_lookup_(integer j, integer l) if (length(text(p)) == l) if (str_eq_buf(text(p), j)) goto lab40; - if (hash[p].v.LH == 0) { + if (hash[p].v.LH == 0) + { if (no_new_control_sequence) p = undefined_control_sequence; else @@ -1898,8 +1949,8 @@ halfword id_lookup_(integer j, integer l) decr(hash_used); } while (!(text(hash_used) == 0)); #ifdef SHORTHASH - if (hash_used > 65535L) - { /* debugging only 1996/Jan/20 */ + if (hash_used > 65535L) /* debugging only 1996/Jan/20 */ + { sprintf(log_line, "ERROR: %s too large %d\n", "hash entry", hash_used); show_line(log_line, 1); } @@ -1908,14 +1959,15 @@ halfword id_lookup_(integer j, integer l) p = hash_used; } #ifdef CHECKPOOL - if (checkpool(NULL)) show_line("after hash_used\n", 0); + if (checkpool(NULL)) + show_line("after hash_used\n", 0); #endif { #ifdef ALLOCATESTRING if (pool_ptr + l > current_pool_size) str_pool = realloc_str_pool(increment_pool_size + 1); - if (pool_ptr + l > current_pool_size) - { /* in case it failed 97/Mar/7 */ + if (pool_ptr + l > current_pool_size) /* in case it failed 97/Mar/7 */ + { overflow("pool size", current_pool_size - init_pool_ptr); /* pool size */ return 0; // abort_flag set } @@ -1935,12 +1987,13 @@ halfword id_lookup_(integer j, integer l) #ifdef CHECKPOOL if (checkpool(NULL)) show_line("after pool_ptr\n", 0); #endif - for (k = j; k <= j + l - 1; k++) append_char(buffer[k]); + for (k = j; k <= j + l - 1; k++) + append_char(buffer[k]); #ifdef SHORTHASH { pool_pointer tempstring = make_string(); - if (tempstring > 65535L) - { /* cannot happen */ + if (tempstring > 65535L) /* cannot happen */ + { sprintf(log_line, "ERROR: %s too large %d\n", "string ptr", tempstring); show_line(log_line, 1); } @@ -1973,7 +2026,8 @@ halfword id_lookup_(integer j, integer l) p = hash[p].v.LH; } #ifdef CHECKPOOL - if (checkpool(NULL)) show_line("before return\n", 0); + if (checkpool(NULL)) + show_line("before return\n", 0); #endif lab40: Result = p; @@ -1988,14 +2042,14 @@ void new_save_level_(group_code c) #ifdef ALLOCATESAVESTACK if (max_save_stack > current_save_size - 6) save_stack = realloc_save_stack(increment_save_size); - if (max_save_stack > current_save_size - 6) - { /* check again after allocation */ + if (max_save_stack > current_save_size - 6) /* check again after allocation */ + { overflow("save size", current_save_size); return; // abort_flag set } #else - if (max_save_stack > save_size - 6) - { /* save size - not dynamic */ + if (max_save_stack > save_size - 6) /* save size - not dynamic */ + { overflow("save size", save_size); return; // abort_flag set } @@ -2017,7 +2071,7 @@ void new_save_level_(group_code c) overflow("grouping levels", max_quarterword - min_quarterword); /* 96/Oct/12 ??? */ return; // abort_flag set } -/* cur_boundary <- save_ptr */ + cur_boundary = save_ptr; incr(cur_level); incr(save_ptr); @@ -2059,14 +2113,14 @@ void eq_save_(halfword p, quarterword l) #ifdef ALLOCATESAVESTACK if (max_save_stack > current_save_size - 6) save_stack = realloc_save_stack (increment_save_size); - if (max_save_stack > current_save_size - 6) - { /* check again after allocation */ + if (max_save_stack > current_save_size - 6) /* check again after allocation */ + { overflow("save size", current_save_size); return; // abort_flag set } #else - if (max_save_stack > save_size - 6) - { /* save size not dynamic */ + if (max_save_stack > save_size - 6) /* save size not dynamic */ + { overflow("save size", save_size); return; // abort_flag set } @@ -2130,14 +2184,14 @@ void save_for_after_(halfword t) #ifdef ALLOCATESAVESTACK if (max_save_stack > current_save_size - 6) save_stack = realloc_save_stack (increment_save_size); - if (max_save_stack > current_save_size - 6) - { /* check again after allocation */ + if (max_save_stack > current_save_size - 6) /* check again after allocation */ + { overflow("save size", current_save_size); return; // abort_flag set } #else - if (max_save_stack > save_size - 6) - { /* save satck - not dynamic */ + if (max_save_stack > save_size - 6) /* save satck - not dynamic */ + { overflow("save size", save_size); return; // abort_flag set } diff --git a/src/texsourc/texd.h b/src/texsourc/texd.h index d85c51b..755bbdf 100644 --- a/src/texsourc/texd.h +++ b/src/texsourc/texd.h @@ -1577,6 +1577,10 @@ EXTERN int tfm_temp; /* only used in tex3.c 95/Jan/7 */ #define shape_ref max_command + 18 #define box_ref max_command + 19 #define data max_command + 20 +/* sec 0211 */ +#define vmode 1 +#define hmode vmode + max_command + 1 +#define mmode hmode + max_command + 1 /* sec 0212 */ #define ignore_depth -65536000L /* sec 0213 */ @@ -2037,22 +2041,22 @@ EXTERN int tfm_temp; /* only used in tex3.c 95/Jan/7 */ #define sub_mlist 3 #define math_text_char 4 /* sec 0682 */ -#define ord_noad unset_node + 3 -#define op_noad ord_noad + 1 -#define bin_noad ord_noad + 2 -#define rel_noad ord_noad + 3 -#define open_noad ord_noad + 4 -#define close_noad ord_noad + 5 -#define punct_noad ord_noad + 6 -#define inner_noad ord_noad + 7 +#define ord_noad unset_node + 3 // 16 +#define op_noad ord_noad + 1 // 17 +#define bin_noad ord_noad + 2 // 18 +#define rel_noad ord_noad + 3 // 19 +#define open_noad ord_noad + 4 // 20 +#define close_noad ord_noad + 5 // 21 +#define punct_noad ord_noad + 6 // 22 +#define inner_noad ord_noad + 7 // 23 #define limits 1 #define no_limits 2 /* sec 0683 */ #define left_delimiter(a) (a) + 4 #define right_delimiter(a) (a) + 5 -#define radical_noad inner_noad + 1 +#define radical_noad inner_noad + 1 // 24 #define radical_noad_size 5 -#define fraction_noad radical_noad + 1 +#define fraction_noad radical_noad + 1 // 25 #define fraction_noad_size 6 #define small_fam(a) mem[(a)].qqqq.b0 #define small_char(a) mem[(a)].qqqq.b1 @@ -2063,14 +2067,14 @@ EXTERN int tfm_temp; /* only used in tex3.c 95/Jan/7 */ #define numerator supscr #define denominator subscr /* sec 0687 */ -#define under_noad fraction_noad + 1 -#define over_noad under_noad + 1 -#define accent_noad over_noad + 1 +#define under_noad fraction_noad + 1 // 26 +#define over_noad under_noad + 1 // 27 +#define accent_noad over_noad + 1 // 28 #define accent_noad_size 5 #define accent_chr(a) (a) + 4 -#define vcenter_noad accent_noad + 1 -#define left_noad vcenter_noad + 1 -#define right_noad left_noad + 1 +#define vcenter_noad accent_noad + 1 // 29 +#define left_noad vcenter_noad + 1 // 30 +#define right_noad left_noad + 1 // 31 #define delimiter nucleus #define script_allowed(a) ((type(a) >= ord_noad) && (type(a) < left_noad)) /* sec 0688 */ @@ -2120,6 +2124,59 @@ EXTERN int tfm_temp; /* only used in tex3.c 95/Jan/7 */ #define broken_ins(a) info(a + 1) #define last_ins_ptr(a) link(a + 2) #define best_ins_ptr(a) info(a + 2) +/* sec 1058 */ +#define fil_code 0 +#define fill_code 1 +#define ss_code 2 +#define fil_neg_code 3 +#define skip_code 4 +#define mskip_code 5 +/* sec 1071 */ +#define box_flag 010000000000 +#define ship_out_flag box_flag + 512 +#define leader_flag box_flag + 513 +#define box_code 0 +#define copy_code 1 +#define last_box_code 2 +#define vsplit_code 3 +#define vtop_code 4 +/* sec 1178 */ +#define above_code 0 +#define over_code 1 +#define atop_code 2 +#define delimited_code 3 +/* sec 1222 */ +#define char_def_code 0 +#define math_char_def_code 1 +#define count_def_code 2 +#define dimen_def_code 3 +#define skip_def_code 4 +#define mu_skip_def_code 5 +#define toks_def_code 6 +/* sec 1290 */ +#define show_code 0 +#define show_box_code 1 +#define show_the_code 2 +#define show_lists 3 +/* sec 1342 */ +#define write_node_size 2 +#define open_node_size 3 +#define open_node 0 +#define write_node 1 +#define close_node 2 +#define special_node 3 +#define language_node 4 +#define what_lang(s) link(s+1) +#define what_lhm(s) type(s+1) +#define what_rhm(s) subtype(s+1) +#define write_tokens(s) link(s+1) +#define write_streams(s) info(s+1) +#define open_name(s) link(s+1) +#define open_area(s) info(s+2) +#define open_ext(s) link(s+2) +/* sec 1344 */ +#define immediate_code 4 +#define set_language_code 5 /* sec 79 */ extern INLINE void tex_help (unsigned int n, ...); -- 2.11.0