if (flag)
{
- show_line("Inverted mapping xord[] pairs:\n", 0);
+ puts("Inverted mapping xord[] pairs:\n");
for (k = 0; k < 256; k++)
{
if (xord[k] != 127)
- {
- sprintf(log_line, "%d => %d\n", k, xord[k]);
- show_line(log_line, 0);
- }
+ printf("%d => %d\n", k, xord[k]);
}
}
}
mode = 1;
head = contrib_head;
tail = contrib_head;
- cur_list.aux_field.cint = ignore_depth;
+ prev_depth = ignore_depth;
mode_line = 0;
prev_graf = 0;
/* shown_mode = 0; */
void line_break_ (integer final_widow_penalty)
{
boolean auto_breaking;
- halfword prevp;
+ halfword prev_p;
halfword q, r, s, prevs;
internal_font_number f;
/* small_number j; */
int j; /* 95/Jan/7 */
/* unsigned char c; */
unsigned int c; /* 95/Jan/7 */
-/* savedbadness = 0; */ /* 96/Feb/9 */
pack_begin_line = mode_line;
link(temp_head) = link(head);
- if ((tail >= hi_mem_min))
- {
+ if (is_char_node(tail))
tail_append(new_penalty(inf_penalty));
- }
else if (type(tail) != glue_node)
- {
tail_append(new_penalty(inf_penalty));
- }
else
{
type(tail) = penalty_node;
init_r_hyf = (prev_graf / 65536L) % 64;
pop_nest();
no_shrink_error_yet = true;
-
- if ((shrink_order(left_skip) != normal) && (shrink(left_skip) != 0))
- {
- left_skip = finite_shrink(left_skip);
- }
-
- if ((shrink_order(right_skip) != normal) && (shrink(right_skip) != 0))
- {
- right_skip = finite_shrink(right_skip);
- }
-
+ check_shrinkage(left_skip);
+ check_shrinkage(right_skip);
q = left_skip;
r = right_skip;
background[1] = width(q) + width(r);
background[2 + stretch_order(q)] = stretch(q);
background[2 + stretch_order(r)] = background[2 + stretch_order(r)] + stretch(r);
background[6] = shrink(q) + shrink(r);
-
minimum_demerits = 1073741823L; /* 2^30 - 1 *//* 40000000 hex - 1 */
minimal_demerits[tight_fit] = 1073741823L;
minimal_demerits[decent_fit] = 1073741823L;
if (threshold >= 0)
{
-
#ifdef STAT
if (tracing_paragraphs > 0)
{
begin_diagnostic();
print_nl("@firstpass");
}
-#endif /* STAT */
+#endif
second_pass = false;
final_pass = false;
#ifdef STAT
if (tracing_paragraphs > 0)
begin_diagnostic();
-#endif /* STAT */
+#endif
}
while (true)
{
if (trie_not_ready)
init_trie();
- } /* bkph */
-#endif /* INITEX */
+ }
+#endif
cur_lang = init_cur_lang;
lhyf = init_l_hyf;
line_number(q) = prev_graf + 1;
total_demerits(q) = 0;
link(active) = q;
- active_width[1] = background[1];
+ act_width = background[1];
active_width[2] = background[2];
active_width[3] = background[3];
active_width[4] = background[4];
cur_p = link(temp_head);
auto_breaking = true;
- prevp = cur_p;
+ prev_p = cur_p;
- while((cur_p != 0) && (link(active) != active))
+ while ((cur_p != 0) && (link(active) != active))
{
- if ((cur_p >= hi_mem_min))
+ if (is_char_node(cur_p))
{
- prevp = cur_p;
+ prev_p = cur_p;
do
{
f = font(cur_p);
- active_width[1] = active_width[1] + char_width(f, char_info(f, character(cur_p)));
+ act_width = act_width + char_width(f, char_info(f, character(cur_p)));
cur_p = link(cur_p);
}
- while(!(!(cur_p >= hi_mem_min)));
+ while (!(!is_char_node(cur_p)));
}
switch(type(cur_p))
case hlist_node:
case vlist_node:
case rule_node:
- active_width[1] = active_width[1] + width(cur_p);
+ act_width = act_width + width(cur_p);
break;
+
case whatsit_node:
if (subtype(cur_p) == language_node)
{
rhyf = what_rhm(cur_p);
}
break;
+
case glue_node:
{
if (auto_breaking)
{
- if ((prevp >= hi_mem_min))
+ if (is_char_node(prev_p))
try_break(0, unhyphenated);
- else if ((mem[prevp].hh.b0 < 9))
+ else if ((mem[prev_p].hh.b0 < 9))
try_break(0, unhyphenated);
- else if ((type(prevp) == kern_node) && (subtype(prevp) != explicit))
+ else if ((type(prev_p) == kern_node) && (subtype(prev_p) != explicit))
try_break(0, unhyphenated);
}
- if ((mem[glue_ptr(cur_p)].hh.b1 != 0) && (mem[glue_ptr(cur_p) + 3].cint != 0))
- {
- glue_ptr(cur_p) = finite_shrink(glue_ptr(cur_p));
- }
-
+ check_shrinkage(glue_ptr(cur_p));
q = glue_ptr(cur_p);
- active_width[1] = active_width[1]+ width(q);
+ act_width = act_width+ width(q);
active_width[2 + stretch_order(q)] = active_width[2 + stretch_order(q)] + stretch(q);
active_width[6] = active_width[6] + shrink(q);
{
while (true)
{
- if ((s >= hi_mem_min))
+ if (is_char_node(s))
{
c = character(s);
hf = font(s);
while (true)
{
- if ((s >= hi_mem_min))
+ if (is_char_node(s))
{
if (font(s) != hf)
goto lab33;
while (true)
{
- if (!((s >= hi_mem_min)))
+ if (!(is_char_node(s)))
switch(type(s))
{
case ligature_node:
break;
case kern_node:
if (subtype(cur_p) == explicit)
- {
- if (!(link(cur_p) >= hi_mem_min) && auto_breaking)
- if (type(link(cur_p)) == glue_node)
- try_break(0, unhyphenated);
-
- active_width[1] = active_width[1] + width(cur_p);
- }
+ kern_break();
else
- active_width[1] = active_width[1] + width(cur_p);
+ act_width = act_width + width(cur_p);
break;
case ligature_node:
{
f = font(lig_char(cur_p));
- active_width[1] = active_width[1] + char_width(f, char_info(f, character(lig_char(cur_p))));
+ act_width = act_width + char_width(f, char_info(f, character(lig_char(cur_p))));
}
break;
case disc_node:
{
do
{
- if ((s >= hi_mem_min))
+ if (is_char_node(s))
{
f = font(s);
disc_width = disc_width + char_width(f, char_info(f, character(s)));
}
s = link(s);
}
- while(!(s == 0));
+ while (!(s == 0));
- active_width[1] = active_width[1] + disc_width;
+ act_width = act_width + disc_width;
try_break(hyphen_penalty, hyphenated);
- active_width[1] = active_width[1] - disc_width;
+ act_width = act_width - disc_width;
}
r = replace_count(cur_p);
s = link(cur_p);
while (r > 0)
{
- if ((s >= hi_mem_min))
+ if (is_char_node(s))
{
f = font(s);
- active_width[1] = active_width[1] + char_width(f, char_info(f, character(s)));
+ act_width = act_width + char_width(f, char_info(f, character(s)));
}
else switch(type(s))
{
case ligature_node:
{
f = font(lig_char(s));
- active_width[1] = active_width[1] + char_width(f, char_info(f, character(lig_char(s))));
+ act_width = act_width + char_width(f, char_info(f, character(lig_char(s))));
}
break;
case vlist_node:
case rule_node:
case kern_node:
- active_width[1] = active_width[1] + width(s);
+ act_width = act_width + width(s);
break;
default:
s = link(s);
}
- prevp = cur_p;
+ prev_p = cur_p;
cur_p = s;
goto lab35;
}
case math_node:
{
- auto_breaking = (subtype(cur_p) == 1);
- {
- if (!(link(cur_p) >= hi_mem_min) && auto_breaking)
- if (type(link(cur_p)) == glue_node)
- try_break(0, unhyphenated);
-
- active_width[1] = active_width[1] + width(cur_p);
- }
+ auto_breaking = (subtype(cur_p) == after);
+ kern_break();
}
break;
break;
}
- prevp = cur_p;
+ prev_p = cur_p;
cur_p = link(cur_p);
lab35:;
}
#ifdef STAT
if (tracing_paragraphs > 0)
print_nl("@secondpass");
-#endif /* STAT */
+#endif
threshold = tolerance;
second_pass = true;
second_pass_count++; /* 96 Feb 9 */
#ifdef STAT
if (tracing_paragraphs > 0)
print_nl("@emergencypass");
-#endif /* STAT */
-/* can only get here is \emergencystretch has been set positive */
+#endif
+
background[2] = background[2] + emergency_stretch;
final_pass = true;
++final_pass_count; /* 96 Feb 9 */
- } /* end of if second_pass */
- } /* end of while(true)do */
-/* cannot drop through from above loop */
-lab30: /* common exit point */
+ }
+ }
+
+lab30:
if (best_line == 2)
single_line++;
end_diagnostic(true);
normalize_selector();
}
-#endif /* STAT */
+#endif
post_line_break(final_widow_penalty);
q = link(active);
{
get_x_token();
}
- while(!((cur_cmd != spacer) && (cur_cmd != relax)));
+ while (!((cur_cmd != spacer) && (cur_cmd != relax)));
if (cur_cmd <= max_non_prefixed_command)
{
switch (cur_cmd)
{
case set_font:
- if ((a >= 4))
- geq_define(cur_font_loc, data, cur_chr);
- else
- eq_define(cur_font_loc, data, cur_chr);
+ define(cur_font_loc, data, cur_chr);
break;
case def:
get_r_token();
p = cur_cs;
q = scan_toks(true, e);
-
- if ((a >= 4))
- geq_define(p, call + (a % 4), def_ref);
- else
- eq_define(p, call + (a % 4), def_ref);
+ define(p, call + (a % 4), def_ref);
}
break;
}
if (cur_cmd >= call)
- incr(mem[cur_chr].hh.lh);
+ add_token_ref(cur_chr);
- if ((a >= 4))
- geq_define(p, cur_cmd, cur_chr);
- else
- eq_define(p, cur_cmd, cur_chr);
+ define(p, cur_cmd, cur_chr);
}
break;
n = cur_chr;
get_r_token();
p = cur_cs;
-
- if ((a >= 4))
- geq_define(p, relax, 256);
- else
- eq_define(p, relax, 256);
-
+ define(p, relax, 256);
scan_optional_equals();
switch (n)
case char_def_code:
{
scan_char_num();
-
- if ((a >= 4))
- geq_define(p, char_given, cur_val);
- else
- eq_define(p, char_given, cur_val);
+ define(p, char_given, cur_val);
}
break;
case math_char_def_code:
{
scan_fifteen_bit_int();
-
- if ((a >= 4))
- geq_define(p, math_given, cur_val);
- else
- eq_define(p, math_given, cur_val);
+ define(p, math_given, cur_val);
}
break;
switch (n)
{
case count_def_code:
- if ((a >= 4))
- geq_define(p, assign_int, count_base + cur_val);
- else
- eq_define(p, assign_int, count_base + cur_val);
+ define(p, assign_int, count_base + cur_val);
break;
case dimen_def_code:
- if ((a >= 4))
- geq_define(p, assign_dimen, scaled_base + cur_val);
- else
- eq_define(p, assign_dimen, scaled_base + cur_val);
+ define(p, assign_dimen, scaled_base + cur_val);
break;
case skip_def_code:
- if ((a >= 4))
- geq_define(p, assign_glue, skip_base + cur_val);
- else
- eq_define(p, assign_glue, skip_base + cur_val);
+ define(p, assign_glue, skip_base + cur_val);
break;
case mu_skip_def_code:
- if ((a >= 4))
- geq_define(p, assign_mu_glue, mu_skip_base + cur_val);
- else
- eq_define(p, assign_mu_glue, mu_skip_base + cur_val);
+ define(p, assign_mu_glue, mu_skip_base + cur_val);
break;
case toks_def_code:
- if ((a >= 4))
- geq_define(p, assign_toks, toks_base + cur_val);
- else
- eq_define(p, assign_toks, toks_base + cur_val);
+ define(p, assign_toks, toks_base + cur_val);
break;
}
}
scan_int();
n = cur_val;
- if (! scan_keyword("to"))
+ if (!scan_keyword("to"))
{
print_err("Missing `to' inserted");
help2("You should have said `\\read<number> to \\cs'.",
get_r_token();
p = cur_cs;
read_toks(n, p);
-
- if ((a >= 4))
- geq_define(p, call, cur_val);
- else
- eq_define(p, call, cur_val);
+ define(p, call, cur_val);
}
break;
{
get_x_token();
}
- while(!((cur_cmd != spacer) && (cur_cmd != relax)));
+ while (!((cur_cmd != spacer) && (cur_cmd != relax)));
if (cur_cmd != left_brace)
{
q = equiv(cur_chr);
if (q == 0)
- if ((a >= 4))
- geq_define(p, undefined_cs, 0);
- else
- eq_define(p, undefined_cs, 0);
+ define(p, undefined_cs, 0);
else
{
- incr(mem[q].hh.lh);
-
- if ((a >= 4))
- geq_define(p, call, q);
- else
- eq_define(p, call, q);
+ add_token_ref(q);
+ define(p, call, q);
}
goto lab30;
}
if (link(def_ref) == 0)
{
- if ((a >= 4))
- geq_define(p, undefined_cs, 0);
- else
- eq_define(p, undefined_cs, 0);
-
+ define(p, undefined_cs, 0);
free_avail(def_ref);
}
else
link(def_ref) = q;
}
- if ((a >= 4))
- geq_define(p, call, def_ref);
- else
- eq_define(p, call, def_ref);
+ define(p, call, def_ref);
}
}
break;
p = cur_chr;
scan_optional_equals();
scan_int();
-
- if ((a >= 4))
- geq_word_define(p, cur_val);
- else
- eq_word_define(p, cur_val);
+ word_define(p, cur_val);
}
break;
p = cur_chr;
scan_optional_equals();
scan_dimen(false, false, false);
-
- if ((a >= 4))
- geq_word_define(p, cur_val);
- else
- eq_word_define(p, cur_val);
+ word_define(p, cur_val);
}
break;
scan_glue(glue_val);
trap_zero_glue();
-
- if ((a >= 4))
- geq_define(p, glue_ref, cur_val);
- else
- eq_define(p, glue_ref, cur_val);
+ define(p, glue_ref, cur_val);
}
break;
else if (cur_chr == del_code_base)
n = 16777215L; /* 2^24 - 1 */
else
- n = 255; /* 2^8 - 1 */
+ n = 255;
p = cur_chr;
scan_char_num();
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);
}
if (p < math_code_base)
- if ((a >= 4))
- geq_define(p, data, cur_val);
- else
- eq_define(p, data, cur_val);
+ define(p, data, cur_val);
else if (p < del_code_base)
- if ((a >= 4))
- geq_define(p, data, cur_val);
- else
- eq_define(p, data, cur_val);
+ define(p, data, cur_val);
else
- if ((a >= 4))
- geq_word_define(p, cur_val);
- else
- eq_word_define(p, cur_val);
+ word_define(p, cur_val);
}
break;
p = p + cur_val;
scan_optional_equals();
scan_font_ident();
-
- if ((a >= 4))
- geq_define(p, data, cur_val);
- else
- eq_define(p, data, cur_val);
+ define(p, data, cur_val);
}
break;
scan_optional_equals();
if (set_box_allowed)
- {
scan_box(box_flag + n);
- }
else
{
print_err("Improper ");
}
}
- if ((a >= 4))
- geq_define(par_shape_loc, shape_ref, p);
- else
- eq_define(par_shape_loc, shape_ref, p);
+ define(par_shape_loc, shape_ref, p);
}
break;
new_patterns();
goto lab30;
}
-#endif /* INITEX */
+#endif
print_err("Patterns can be loaded only by INITEX");
help_ptr = 0;
error();
{
get_token();
}
- while(!(cur_cmd == right_brace));
+ while (!(cur_cmd == right_brace));
return;
}
undump_int(x);
- if (x != BEGINFMTCHECKSUM) /* magic FMT file start 4C 20 E6 15 hex */
- goto lab6666;
+ if (x != BEGINFMTCHECKSUM)
+ goto lab_bad_fmt;
undump_int(x); /* mem_bot */
if (x != mem_bot)
- goto lab6666;
+ goto lab_bad_fmt;
undump_int(x); /* mem_top */
#ifdef ALLOCATEMAIN
/* we already read this once earlier to grab mem_top */
if (trace_flag)
- {
- sprintf(log_line, "Read from fmt file mem_top = %d TeX words\n", x);
- show_line(log_line, 0);
- }
+ printf("Read from fmt file mem_top = %d TeX words\n", x);
mem = allocate_main_memory(x); /* allocate main memory at this point */
exit(1); /* redundant sanity test ! */
initialize_aux(); /* do `mem' part of initialize */
-/* mem = zmem; */ /* update pointer to main memory */
#endif
if (x != mem_top)
- goto lab6666;
+ goto lab_bad_fmt;
undump_int(x); /* eqtb_size */
- if (x != (eqtb_size))
- goto lab6666;
+ if (x != eqtb_size)
+ goto lab_bad_fmt;
undump_int(x); /* hash_prime */
if (x != hash_prime)
- goto lab6666;
+ goto lab_bad_fmt;
undump_int(x); /* hyphen_prime */
#ifdef ALLOCATEHYPHEN
/* allow format files dumped with arbitrary (prime) hyphenation exceptions */
- realloc_hyphen(x); /* reset_hyphen(); */
+ realloc_hyphen(x);
hyphen_prime = x;
#endif
if (x != hyphen_prime)
- goto lab6666;
+ goto lab_bad_fmt;
{
undump_int(x); /* pool_size */
if (x < 0)
- goto lab6666;
+ goto lab_bad_fmt;
#ifdef ALLOCATESTRING
if (x > current_pool_size)
{
if (trace_flag)
- {
- sprintf(log_line, "undump string pool reallocation (%d > %d)\n", x, current_pool_size);
- show_line(log_line, 0);
- }
+ printf("undump string pool reallocation (%d > %d)\n", x, current_pool_size);
str_pool = realloc_str_pool (x - current_pool_size + increment_pool_size);
}
- if (x > current_pool_size) /* 94/Jan/24 */
+ if (x > current_pool_size)
#else
if (x > pool_size)
#endif
{
- sprintf(log_line, "%s%s\n", "---! Must increase the ", "string pool size");
- show_line(log_line, 0);
- goto lab6666;
+ printf("%s%s\n", "---! Must increase the ", "string pool size");
+ goto lab_bad_fmt;
}
else
pool_ptr = x;
{
undump_int(x); /* max_strings */
+
if (x < 0)
- goto lab6666;
+ goto lab_bad_fmt;
#ifdef ALLOCATESTRING
if (x > current_max_strings)
{
if (trace_flag)
- {
- sprintf(log_line, "undump string pointer reallocation (%d > %d)\n", x, current_max_strings);
- show_line(log_line, 0);
- }
+ printf("undump string pointer reallocation (%d > %d)\n", x, current_max_strings);
str_start = realloc_str_start(x - current_max_strings + increment_max_strings);
}
if (x > max_strings)
#endif
{
- sprintf(log_line, "%s%s\n", "---! Must increase the ", "max strings");
- show_line(log_line, 0);
- goto lab6666;
+ printf("%s%s\n", "---! Must increase the ", "max strings");
+ goto lab_bad_fmt;
}
else
str_ptr = x;
init_str_ptr = str_ptr;
init_pool_ptr = pool_ptr;
-
- /* undump the dynamic memory - paragraph 1312 in the book */
- {
- undump_int(x);
-
- if ((x < lo_mem_stat_max + 1000) || (x > hi_mem_stat_min - 1))
- goto lab6666;
- else
- lo_mem_max = x;
- }
-
- {
- undump_int(x);
-
- if ((x < lo_mem_stat_max + 1) || (x > lo_mem_max))
- goto lab6666;
- else
- rover = x;
- }
-
+ undump(lo_mem_stat_max + 1000, hi_mem_stat_min - 1, lo_mem_max);
+ undump(lo_mem_stat_max + 1, lo_mem_max, rover);
p = mem_bot;
q = rover;
p = q + node_size(q);
if ((p > lo_mem_max) || ((q >= rlink(q)) && (rlink(q) != rover)))
- goto lab6666;
+ goto lab_bad_fmt;
q = rlink(q);
}
{
/* or call add_variable_space(mem_bot - (mem_min + 1)) */
if (trace_flag)
- show_line("Splicing in mem_min space in undump!\n", 0);
+ puts("Splicing in mem_min space in undump!\n");
p = llink(rover);
q = mem_min + 1;
rlink(q) = rover;
llink(q) = p;
link(q) = empty_flag;
- node_size(q) = mem_bot - q; /* ? size of block */
- }
-
- {
- undump_int(x);
-
- if ((x < lo_mem_max + 1) || (x > hi_mem_stat_min))
- goto lab6666;
- else
- hi_mem_min = x;
- }
-
- {
- undump_int(x);
-
- if ((x < mem_bot) || (x > mem_top))
- goto lab6666;
- else
- avail = x;
+ node_size(q) = mem_bot - q;
}
+ undump(lo_mem_max + 1, hi_mem_stat_min, hi_mem_min);
+ undump(mem_bot, mem_top, avail);
mem_end = mem_top;
if (undumpthings(mem[hi_mem_min], mem_end + 1 - hi_mem_min))
undump_int(x);
if ((x < 1) || (k + x > (eqtb_size + 1)))
- goto lab6666;
+ goto lab_bad_fmt;
if (undumpthings(eqtb[k], x))
return -1;
undump_int(x);
if ((x < 0) || (k + x > (eqtb_size + 1)))
- goto lab6666;
+ goto lab_bad_fmt;
for (j = k; j <= k + x - 1; j++)
- {
eqtb[j] = eqtb[k - 1];
- }
k = k + x;
}
- while(!(k > (eqtb_size)));
-
- {
- undump_int(x);
-
- if ((x < hash_base) || (x > (frozen_control_sequence))) /*96/Jan/10*/
- goto lab6666;
- else
- par_loc = x;
- }
+ while (!(k > eqtb_size));
+ undump(hash_base, frozen_control_sequence, par_loc);
par_token = cs_token_flag + par_loc;
-
- {
- undump_int(x);
-
- if ((x < hash_base) || (x > (frozen_control_sequence))) /*96/Jan/10*/
- goto lab6666;
- else
- write_loc = x;
- }
-
- {
- undump_int(x);
- if ((x < hash_base) || (x > (frozen_control_sequence))) /*96/Jan/10*/
- goto lab6666;
- else
- hash_used = x;
- }
+ undump(hash_base, frozen_control_sequence, write_loc);
+ undump(hash_base, frozen_control_sequence, hash_used);
p = hash_base - 1;
do
{
- {
- undump_int(x);
-
- if ((x < p + 1) || (x > hash_used))
- goto lab6666;
- else
- p = x;
- }
-
+ undump(p + 1, hash_used, p);
undump_hh(hash[p]);
}
while (!(p == hash_used));
undump_int(cs_count);
if (trace_flag)
- {
- sprintf(log_line, "itex undump cs_count %d ", cs_count);
- show_line(log_line, 0);
- }
+ printf("itex undump cs_count %d ", cs_count);
{
- undump_int(x); /* font_mem_size */
+ undump_int(x); /* font_mem_size */
if (x < 7)
- goto lab6666;
+ goto lab_bad_fmt;
#ifdef ALLOCATEFONT
if (trace_flag)
- {
- sprintf(log_line, "Read from fmt fmem_ptr = %d\n", x);
- show_line(log_line, 0);
- }
+ printf("Read from fmt fmem_ptr = %d\n", x);
- if (x > current_font_mem_size) /* 93/Nov/28 dynamic allocate font_info */
+ if (x > current_font_mem_size)
{
if (trace_flag)
- {
- sprintf(log_line, "Undump realloc font_info (%d > %d)\n", x, current_font_mem_size);
- show_line(log_line, 0);
- }
+ printf("Undump realloc font_info (%d > %d)\n", x, current_font_mem_size);
font_info = realloc_font_info (x - current_font_mem_size + increment_font_mem_size);
}
- if (x > current_font_mem_size) /* in case allocation failed 94/Jan/24 */
+ if (x > current_font_mem_size)
#else
if (x > font_mem_size)
#endif
{
- sprintf(log_line, "%s%s\n", "---! Must increase the ", "font mem size");
- show_line(log_line, 0);
- goto lab6666;
+ puts("---! Must increase the font mem size\n");
+ goto lab_bad_fmt;
}
else
fmem_ptr = x;
undump_int(x); /* font_max */
if (x < 0)
- goto lab6666;
+ goto lab_bad_fmt;
if (x > font_max)
{
- sprintf(log_line, "%s%s\n", "---! Must increase the ", "font max");
- show_line(log_line, 0);
- goto lab6666;
+ puts("---! Must increase the font max\n");
+ goto lab_bad_fmt;
}
else
font_ptr = x;
}
- frozen_font_ptr = font_ptr; /* remember number of fonts frozen into format */
+ frozen_font_ptr = font_ptr;
if (undumpthings(font_check[0], font_ptr + 1))
return -1;
if (undumpthings(char_base[0], font_ptr + 1))
return -1;
- if (undumpthings(ctype_base[0], font_ptr + 1))
- return -1;
-
if (undumpthings(width_base[0], font_ptr + 1))
return -1;
/* non_address from font_mem_size to 0 96/Jan/15 ??? */
#ifdef ALLOCATEFONT
-/* deal with fmt files dumped with *different* font_mem_size 93/Nov/29 */
{
int count = 0, oldfont_mem_size = 0;
if (bchar_label[x] > oldfont_mem_size)
oldfont_mem_size = bchar_label[x];
}
-
- /* somewhat arbitrary sanity check ... */
- if (oldfont_mem_size != non_address && oldfont_mem_size > font_max) /* 96/Jan/16 */
+
+ if (oldfont_mem_size != non_address && oldfont_mem_size > font_max)
{
for (x = 0; x <= font_ptr; x++)
{
if (bchar_label[x] == oldfont_mem_size)
{
- /* bchar_label[x] = font_mem_size; */
- bchar_label[x] = non_address; /* 96/Jan/16 */
+ bchar_label[x] = non_address;
count++;
}
}
if (trace_flag)
- {
- sprintf(log_line, "oldfont_mem_size is %d --- hit %d times. Using non_address %d\n",
+ printf("oldfont_mem_size is %d --- hit %d times. Using non_address %d\n",
oldfont_mem_size, count, non_address);
- show_line(log_line, 0);
- }
}
}
#endif
-/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
-/* undump(0)(hyph_size)(hyph_count); */
- {
- undump_int(x);
- if ((x < 0) || (x > hyphen_prime))
- goto lab6666;
- else
- hyph_count = x;
- }
+ undump(0, hyphen_prime, hyph_count);
- /* undump hypenation exception tables p.1325 */
for (k = 1; k <= hyph_count; k++)
{
- {
- undump_int(x);
-
- if ((x < 0) || (x > hyphen_prime))
- goto lab6666;
- else
- j = x;
- }
-
- {
- undump_int(x);
-
- if ((x < 0) || (x > str_ptr))
- goto lab6666;
- else
- hyph_word[j] = x;
- }
-
- {
- undump_int(x);
-
- if ((x < 0) || (x > max_halfword)) /* mem_top ? no p.1325 */
- goto lab6666;
- else
- hyph_list[j] = x;
- }
+ undump(0, hyphen_prime, j);
+ undump(0, str_ptr, hyph_word[j]);
+ undump(0, max_halfword, hyph_list[j]);
}
#ifdef ALLOCATEHYPHEN
undump_int(x);
if (x < 0)
- goto lab6666;
+ goto lab_bad_fmt;
#ifdef ALLOCATETRIES
if (!is_initex)
if (x > trie_size)
{
- sprintf(log_line, "%s%s\n", "---! Must increase the ", "trie size");
- show_line(log_line, 0);
- goto lab6666;
+ puts("---! Must increase the trie size\n");
+ goto lab_bad_fmt;
}
else
j = x;
}
+
#ifdef INITEX
- if (is_initex) /* bkph */
+ if (is_initex)
trie_max = j;
-#endif /* INITEX */
+#endif
+
if (undumpthings(trie_trl[0], j + 1))
return -1;
undump_int(x);
if (x < 0)
- goto lab6666;
+ goto lab_bad_fmt;
if (x > trie_op_size)
{
- sprintf(log_line, "%s%s\n", "---! Must increase the ", "trie op size");
- show_line(log_line, 0);
- goto lab6666;
+ puts("---! Must increase the trie op size\n");
+ goto lab_bad_fmt;
}
else
j = x;
}
#ifdef INITEX
- if (is_initex) /* bkph */
+ if (is_initex)
trie_op_ptr = j;
-#endif /* INITEX */
+#endif
if (undumpthings(hyf_distance[1], j))
return -1;
return -1;
#ifdef INITEX
- if (is_initex) /* bkph */
+ if (is_initex)
{
for (k = 0; k <= 255; k++)
- {
- trie_used[k] = 0;
- }
+ trie_used[k] = min_quarterword;
}
-#endif /* INITEX */
+#endif
+
k = 256;
while (j > 0)
{
- {
- undump_int(x);
-
- if ((x < 0) || (x > k - 1))
- goto lab6666;
- else
- k = x;
- }
+ undump(0, k - 1, k);
+ undump(1, j, x);
- {
- undump_int(x);
-
- if ((x < 1) || (x > j))
- goto lab6666;
- else
- x = x;
- }
#ifdef INITEX
- if (is_initex) /* bkph */
+ if (is_initex)
trie_used[k] = x;
-#endif /* INITEX */
-/* j:=j-x; op_start[k]:=qo(j); */
+#endif
+
j = j - x;
op_start[k] = j;
}
+
#ifdef INITEX
- if (is_initex) /* bkph */
+ if (is_initex)
trie_not_ready = false;
-#endif /* INITEX */
- {
- undump_int(x);
-
- if ((x < batch_mode) || (x > error_stop_mode))
- goto lab6666;
-
- if (interaction < batch_mode) /* may now set in local.c bkph 94/Jan/8 */
- interaction = x;
- }
-
- {
- undump_int(x);
-
- if ((x < 0) || (x > str_ptr))
- goto lab6666;
- else
- format_ident = x;
- }
+#endif
+ undump(batch_mode, error_stop_mode, interaction);
+ undump(0, str_ptr, format_ident);
undump_int(x);
if ((x != ENDFMTCHECKSUM) || feof(fmt_file))
- goto lab6666;
+ goto lab_bad_fmt;
return true;
-lab6666:;
- sprintf(log_line, "(Fatal format file error; I'm stymied)\n");
- show_line(log_line, 1);
+lab_bad_fmt:;
+ puts("(Fatal format file error; I'm stymied)\n");
return false;
}
while (input_ptr > 0)
{
- if (cur_input.state_field == 0)
+ if (state == 0)
{
end_token_list();
}
if (cs_token_flag + undefined_control_sequence > max_halfword)
bad = 21;
- if (format_default_length > PATH_MAX)
+ if (format_default_length > file_name_size)
bad = 31;
if (max_halfword < (mem_top - mem_min) / 2)
if (bad > 0)
{
- sprintf(log_line, "%s%s%ld\n", "Ouch---my internal constants have been clobbered!",
+ printf("%s%s%ld\n", "Ouch---my internal constants have been clobbered!",
"---case ", (long) bad);
- show_line(log_line, 1);
goto lab9999;
}
file_offset = 0;
show_line(tex_version, 0);
- {
#ifdef _WIN32
#ifdef _WIN64
- sprintf(log_line, " (%s %s/Windows 64bit)", application, yandyversion);
+ printf(log_line, " (%s %s/Windows 64bit)", application, yandyversion);
#else
- sprintf(log_line, " (%s %s/Windows 32bit)", application, yandyversion);
+ printf(log_line, " (%s %s/Windows 32bit)", application, yandyversion);
#endif
#else
- sprintf(log_line, " (%s %s/Linux)", application, yandyversion);
+ printf(log_line, " (%s %s/Linux)", application, yandyversion);
#endif
- }
-
- show_line(log_line, 0);
if (format_ident > 0)
slow_print(format_ident);
scanner_status = 0;
warning_index = 0;
first = 1;
- cur_input.state_field = new_line;
- cur_input.start_field = 1;
- cur_input.index_field = 0;
+ state = new_line;
+ start = 1;
+ index = 0;
line = 0;
cur_input.name_field = 0;
force_eof = false;
if (!init_terminal())
goto lab9999;
- cur_input.limit_field = last;
+ limit = last;
first = last + 1;
}
if ((format_ident == 0) ||
- (buffer[cur_input.loc_field] == '&') ||
- (buffer[cur_input.loc_field] == '+'))
+ (buffer[loc] == '&') ||
+ (buffer[loc] == '+'))
{
if (format_ident != 0)
initialize();
w_close(fmt_file);
#endif
- while ((cur_input.loc_field < cur_input.limit_field) &&
- (buffer[cur_input.loc_field] == ' '))
- incr(cur_input.loc_field);
+ while ((loc < limit) &&
+ (buffer[loc] == ' '))
+ incr(loc);
}
- if ((end_line_char < 0) || (end_line_char > 255))
- decr(cur_input.limit_field);
+ if (end_line_char_inactive())
+ decr(limit);
else
- buffer[cur_input.limit_field] = end_line_char;
+ buffer[limit] = end_line_char;
fix_date_and_time();
magic_offset = str_start[886] - 9 * ord_noad;
else
selector = term_only;
- if ((cur_input.loc_field < cur_input.limit_field) &&
- (cat_code(buffer[cur_input.loc_field]) != escape))
+ if ((loc < limit) &&
+ (cat_code(buffer[loc]) != escape))
start_input();
}
if (mem_min < mem_start) /* sanity test */
{
if (trace_flag)
- show_line("WARNING: mem_min < mem_start!\n", 0);
+ puts("WARNING: mem_min < mem_start!\n");
mem_min = mem_start;
}
cur_font = null_font;
eq_type(cur_font_loc) = data;
eq_level(cur_font_loc) = level_one;
- cur_jfont = null_font;
- eq_type(cur_jfont_loc) = data;
- eq_level(cur_jfont_loc) = level_one;
- cur_tfont = null_font;
- eq_type(cur_tfont_loc) = data;
- eq_level(cur_tfont_loc) = level_one;
for (k = math_font_base; k <= math_font_base + 47; k++)
eqtb[k] = eqtb[cur_font_loc];
for (k = cat_code_base; k <= int_base - 1; k++)
eqtb[k] = eqtb[cat_code_base];
- eqtb[auto_spacing_code] = eqtb[cat_code_base];
- eqtb[auto_xspacing_code] = eqtb[cat_code_base];
-
for (k = 0; k <= 255; k++)
{
cat_code(k) = other_char;
- kcat_code(k) = other_char;
math_code(k) = k;
sf_code(k) = 1000;
- auto_xsp_code(k) = 0;
- inhibit_xsp_code(k) = 0;
- inhibit_xsp_type(k) = 0;
- kinsoku_code(k) = 0;
- kinsoku_type(k) = 0;
}
cat_code(carriage_return) = car_ret;
cs_count = 0;
if (trace_flag)
- show_line("initex cs_count = 0 ", 0);
+ puts("initex cs_count = 0 ");
eq_type(frozen_dont_expand) = dont_expand;
text(frozen_dont_expand) = 499; /* notexpanded */
font_ec[null_font] = 0;
font_size[null_font] = 0;
font_dsize[null_font] = 0;
- ctype_base[null_font] = 0;
char_base[null_font] = 0;
width_base[null_font] = 0;
height_base[null_font] = 0;
#ifdef SHORTHASH
if (s > 65535L)
- show_line("ERROR: hash entry too large\n", 1);
+ puts("ERROR: hash entry too large\n");
#endif
text(cur_val) = s;
p = trie_r[p];
}
- while(!(p == 0));
+ while (!(p == 0));
}
/* sec 0959 */
void trie_fix_ (trie_pointer p)
p = trie_r[p];
}
- while(!(p == 0));
+ while (!(p == 0));
}
/* sec 0960 */
void new_patterns (void)
if (allow_patterns)
{
if (trace_flag)
- show_line("Resetting patterns\n", 0);
+ puts("Resetting patterns\n");
reset_trie(); /* RESET PATTERNS - 93/Nov/26 */
if (reset_exceptions)
{
if (trace_flag)
- show_line("Resetting exceptions\n", 0);
+ puts("Resetting exceptions\n");
reset_hyphen(); /* RESET HYPHENEXCEPTIONS - 93/Nov/26 */
}
r = s;
}
- while(!(r > trie_max));
+ while (!(r > trie_max));
}
trie_trc[0] = 63;
if (!is_initex)
{
- show_line("! \\dump is performed only by INITEX\n", 1);
+ puts("! \\dump is performed only by INITEX\n");
- if (! knuth_flag)
- show_line(" (Use -i on the command line)\n", 0);
+ if (!knuth_flag)
+ puts(" (Use -i on the command line)\n");
abort_flag++;
return;
format_ident = make_string();
pack_job_name(".fmt");
- while(!w_open_out(fmt_file))
+ while (!w_open_out(fmt_file))
{
prompt_file_name("format file name", ".fmt");
}
print_nl("");
slow_print(format_ident);
- dump_int(BEGINFMTCHECKSUM); /* magic FMT file start 4C 20 E6 15 hex */
-
+ dump_int(BEGINFMTCHECKSUM);
dump_int(mem_bot);
dump_int(mem_top);
dump_int(eqtb_size);
cs_count = frozen_control_sequence - 1 - hash_used;
if (trace_flag)
- {
- sprintf(log_line, "itex cs_count %d hash_size %d hash_extra %d hash_used %d",
+ printf("itex cs_count %d hash_size %d hash_extra %d hash_used %d",
cs_count, hash_size, hash_extra, hash_used);
- show_line(log_line, 0);
- }
for (p = hash_base; p <= hash_used; p++)
{
incr(cs_count);
if (trace_flag)
- {
- sprintf(log_line, "itex cs_count++ ");
- show_line(log_line, 0);
- }
+ puts("itex cs_count++ ");
}
}
if (dumpthings(char_base[0], font_ptr + 1))
return;
- if (dumpthings(ctype_base[0], font_ptr + 1))
- return;
-
if (dumpthings(width_base[0], font_ptr + 1))
return;
primitive("spaceskip", assign_glue, glue_base + space_skip_code);
primitive("xspaceskip", assign_glue, glue_base + xspace_skip_code);
primitive("parfillskip", assign_glue, glue_base + par_fill_skip_code);
- primitive("kanjiskip", assign_glue, glue_base + kanji_skip_code);
- primitive("xkanjiskip", assign_glue, glue_base + xkanji_skip_code);
primitive("thinmuskip", assign_mu_glue, glue_base + thin_mu_skip_code);
primitive("medmuskip", assign_mu_glue, glue_base + med_mu_skip_code);
primitive("thickmuskip", assign_mu_glue, glue_base + thick_mu_skip_code);
primitive("defaultskewchar", assign_int, int_base + default_skew_char_code);
primitive("endlinechar", assign_int, int_base + end_line_char_code);
primitive("newlinechar", assign_int, int_base + new_line_char_code);
- primitive("jfam", assign_int, int_base + cur_jfam_code);
- primitive("jcharwidowpenalty", assign_int, int_base + jchr_widow_penalty_code);
primitive("language", assign_int, int_base + language_code);
primitive("lefthyphenmin", assign_int, int_base + left_hyphen_min_code);
primitive("righthyphenmin", assign_int, int_base + right_hyphen_min_code);
primitive("hangindent", assign_dimen, dimen_base + hang_indent_code);
primitive("hoffset", assign_dimen, dimen_base + h_offset_code);
primitive("voffset", assign_dimen, dimen_base + v_offset_code);
- primitive("tbaselineshift", assign_dimen, dimen_base + t_baseline_shift_code);
- primitive("ybaselineshift", assign_dimen, dimen_base + y_baseline_shift_code);
primitive("emergencystretch", assign_dimen, dimen_base + emergency_stretch_code);
primitive(" ", ex_space, 0);
primitive("/", ital_corr, 0);
eqtb[frozen_end_group] = eqtb[cur_val];
primitive("expandafter", expand_after, 0);
primitive("font", def_font, 0);
- //primitive("jfont", def_jfont, 0);
- //primitive("tfont", def_tfont, 0);
primitive("fontdimen", assign_font_dimen, 0);
primitive("halign", halign, 0);
primitive("hrule", hrule, 0);
primitive("muskipdef", shorthand_def, 5);
primitive("toksdef", shorthand_def, 6);
primitive("catcode", def_code, cat_code_base);
- primitive("kcatcode", def_code, kcat_code_base);
- primitive("xspcode", def_code, auto_xsp_code_base);
primitive("mathcode", def_code, math_code_base);
primitive("lccode", def_code, lc_code_base);
primitive("uccode", def_code, uc_code_base);
primitive("sfcode", def_code, sf_code_base);
- primitive("delcode", def_code, del_code_base);
- primitive("textfont", def_family, math_font_base);
- primitive("scriptfont", def_family, math_font_base + script_size);
- primitive("scriptscriptfont", def_family, math_font_base + script_script_size);
+ primitive("delcode", def_code, (hash_size + 3474));
+ primitive("textfont", def_family, (hash_size + 1835));
+ primitive("scriptfont", def_family, (hash_size + 1851));
+ primitive("scriptscriptfont", def_family, (hash_size + 1867));
primitive("hyphenation", hyph_data, 0);
primitive("patterns", hyph_data, 1);
primitive("hyphenchar", assign_font_int, 0);
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, show_code);
- primitive("showbox", xray, show_box_code);
- primitive("showthe", xray, show_the_code);
- primitive("showlists", xray, show_lists);
- //primitive("showmode", xray, show_mode);
+ primitive("lowercase", case_shift, (hash_size + 2139));
+ primitive("uppercase", case_shift, (hash_size + 2395));
+ primitive("show", xray, 0);
+ primitive("showbox", xray, 1);
+ primitive("showthe", xray, 2);
+ primitive("showlists", xray, 3);
primitive("openout", extension, 0);
primitive("write", extension, 1);
write_loc = cur_val;