OKsofar = true;
negative = false;
- do {
- do
+ do
+ {
+ do
+ {
+ get_x_token();
+ }
+ while (!(cur_cmd != spacer));
+
+ if (cur_tok == other_token + '-')
{
- get_x_token();
+ negative = !negative;
+ cur_tok = other_token + '+';
}
- while (!(cur_cmd != spacer));
-
- if (cur_tok == other_token + '-')
- {
- negative = !negative;
- cur_tok = other_token + '+';
}
- } while (!(cur_tok != other_token + '+'));
+ while (!(cur_tok != other_token + '+'));
if (cur_tok == alpha_token)
{
if (!shortcut)
{
negative = false;
- do {
- do
- {
- get_x_token();
- }
- while (!(cur_cmd != spacer));
- if (cur_tok == other_token + '-')
+ do
{
- negative = ! negative;
- cur_tok = other_token + '+';
+ do
+ {
+ get_x_token();
+ }
+ while (!(cur_cmd != spacer));
+
+ if (cur_tok == other_token + '-')
+ {
+ negative = ! negative;
+ cur_tok = other_token + '+';
+ }
}
- } while (!(cur_tok != other_token + '+'));
+ while (!(cur_tok != other_token + '+'));
if ((cur_cmd >= min_internal) && (cur_cmd <= max_internal))
{
{
scan_something_internal(dimen_val, false);
}
+
v = cur_val;
goto lab40;
}
do
{
- do {
+ do
+ {
get_x_token();
- }
+ }
while (!(cur_cmd != spacer));
if (cur_tok == other_token + '-')
halfword q;
q = new_rule();
+
if (cur_cmd == vrule)
width(q) = default_rule;
else
{
{
q = avail;
+
if (q == 0)
q = get_avail();
- else {
+ else
+ {
avail = mem[q].hh.v.RH;
mem[q].hh.v.RH = 0;
#ifdef STAT
pool_pointer b;
c = cur_chr;
+
switch (c)
{
case number_code:
case roman_numeral_code:
scan_int();
break;
+
case string_code:
case meaning_code:
savescannerstatus = scanner_status;
get_token();
scanner_status = savescannerstatus;
break;
+
case font_name_code:
scan_font_ident();
break;
+
case job_name_code:
if (job_name == 0)
open_log_file();
break;
}
+
old_setting = selector;
selector = new_string;
b = pool_ptr;
case number_code:
print_int(cur_val);
break;
+
case roman_numeral_code:
print_roman_int(cur_val);
break;
+
case string_code:
if (cur_cs != 0)
sprint_cs(cur_cs);
else
print_char(cur_chr);
break;
+
case meaning_code:
print_meaning();
break;
+
case font_name_code:
print(font_name[cur_val]);
print_string("pt");
}
break;
+
case job_name_code:
print(job_name);
break;
}
+
selector = old_setting;
link(garbage) = str_toks(b);
begin_token_list(link(temp_head), 4);
{
q = get_avail();
mem[p].hh.v.RH = q;
- mem[q].hh.v.LH = 3584;
+ mem[q].hh.v.LH = end_match_token;
p = q;
}
def_ref = get_avail();
token_ref_count(def_ref) = 0;
p = def_ref;
+
{
q = get_avail();
mem[p].hh.v.RH = q;
s = align_state;
align_state = 1000000L;
- do {
- begin_file_reading();
- cur_input.name_field = m + 1;
+ do
+ {
+ begin_file_reading();
+ cur_input.name_field = m + 1;
- if (read_open[m] == closed)
- if (interaction > nonstop_mode)
- if (n < 0)
+ if (read_open[m] == closed)
+ if (interaction > nonstop_mode)
+ if (n < 0)
+ {
+ print_string("");
+ term_input("", 0);
+ }
+ else
+ {
+ print_ln();
+ sprint_cs(r);
+ {
+ print_string("=");
+ term_input("=", 0);
+ }
+ n = -1;
+ }
+ else
{
- print_string("");
- term_input("", 0);
+ fatal_error("*** (cannot \\read from terminal in nonstop modes)");
+ return; // abort_flag set
}
+ else if (read_open[m] == 1)
+ if (input_ln(read_file[m], false))
+ read_open[m] = 0;
else
{
- print_ln();
- sprint_cs(r);
- {
- print_string("=");
- term_input("=", 0);
- }
- n = -1;
+ (void) a_close(read_file[m]);
+ read_open[m] = 2;
}
else
{
- fatal_error("*** (cannot \\read from terminal in nonstop modes)");
- return; // abort_flag set
+ if (!input_ln(read_file[m], true))
+ {
+ (void) a_close(read_file[m]);
+ read_open[m] = 2;
+
+ if (align_state != 1000000L)
+ {
+ runaway();
+ print_err("File ended within ");
+ print_esc("read");
+ help1("This \\read has unbalanced braces.");
+ align_state = 1000000L;
+ error();
+ }
+ }
}
- else if (read_open[m] == 1)
- if (input_ln(read_file[m], false))
- read_open[m] = 0;
+
+ cur_input.limit_field = last;
+
+ if ((end_line_char < 0) || (end_line_char > 255))
+ decr(cur_input.limit_field);
else
+ buffer[cur_input.limit_field] = end_line_char;
+
+ first = cur_input.limit_field + 1;
+ cur_input.loc_field = cur_input.start_field;
+ cur_input.state_field = new_line;
+
+ while (true)
{
- (void) a_close(read_file[m]);
- read_open[m] = 2;
- }
- else
- {
- if (!input_ln(read_file[m], true))
- {
- (void) a_close(read_file[m]);
- read_open[m] = 2;
- if (align_state != 1000000L)
+ get_token();
+
+ if (cur_tok == 0)
+ goto lab30;
+
+ if (align_state < 1000000L)
{
- runaway();
- print_err("File ended within ");
- print_esc("read");
- help1("This \\read has unbalanced braces.");
+ do
+ {
+ get_token();
+ }
+ while(!(cur_tok == 0));
+
align_state = 1000000L;
- error();
+ goto lab30;
+ }
+
+ {
+ q = get_avail();
+ mem[p].hh.v.RH = q;
+ mem[q].hh.v.LH = cur_tok;
+ p = q;
}
}
- }
- cur_input.limit_field = last;
- if ((end_line_char < 0) || (end_line_char > 255))
- decr(cur_input.limit_field);
- else
- buffer[cur_input.limit_field] = end_line_char;
- first = cur_input.limit_field + 1;
- cur_input.loc_field = cur_input.start_field;
- cur_input.state_field = new_line;
- while (true) {
- get_token();
- if (cur_tok == 0)
- goto lab30;
- if (align_state < 1000000L)
- {
- do {
- get_token();
- } while(!(cur_tok == 0));
- align_state = 1000000L;
- goto lab30;
- }
- {
- q = get_avail();
- mem[p].hh.v.RH = q;
- mem[q].hh.v.LH = cur_tok;
- p = q;
- }
- }
lab30:
- end_file_reading();
- } while(!(align_state == 1000000L));
+ end_file_reading();
+ }
+ while(!(align_state == 1000000L));
+
cur_val = def_ref;
scanner_status = normal;
align_state = s;
scanner_status = skipping;
l = 0;
skip_line = line;
- while (true) {
+
+ while (true)
+ {
get_next();
+
if (cur_cmd == fi_or_else)
{
if (l == 0)
goto lab30;
+
if (cur_chr == 2)
decr(l);
}
void change_if_limit_(small_number l, halfword p)
{
halfword q;
+
if (p == cond_ptr)
if_limit = l;
else
{
q = cond_ptr;
- while (true) {
+
+ while (true)
+ {
if (q == 0)
{
confusion("if");
return; // abort_flag set
}
+
if (link(q) == p)
{
type(p) = l;
return;
}
- q = mem[q].hh.v.RH;
+
+ q = link(q);
}
}
}
small_number savescannerstatus;
halfword savecondptr;
small_number thisif;
+
{
p = get_node(if_node_size);
link(p) = cond_ptr;
if_limit = if_code;
if_line = line;
}
+
savecondptr = cond_ptr;
thisif = cur_chr;
+
switch (thisif)
{
case if_char_code:
{
{
get_x_token();
+
if (cur_cmd == relax)
- if (cur_chr == 257) /* if cur_chr = no_expand_flag then ... p.506 */
+ if (cur_chr == no_expand_flag)
{
cur_cmd = active_char;
- cur_chr = cur_tok - 4096;
+ cur_chr = cur_tok - cs_token_flag - active_base;
}
}
+
if ((cur_cmd > active_char) || (cur_chr > 255))
{
m = relax;
}
{
get_x_token();
+
if (cur_cmd == relax)
- if (cur_chr == 257) /* if cur_chr = no_expand_flag then ... p.506 */
+ if (cur_chr == no_expand_flag)
{
cur_cmd = active_char;
- cur_chr = cur_tok - 4096;
+ cur_chr = cur_tok - cs_token_flag - active_base;
}
}
+
if ((cur_cmd > active_char) || (cur_chr > 255))
{
cur_cmd = relax;
cur_chr = 256;
}
+
if (thisif == if_char_code)
b = (n == cur_chr);
else
b = (m == cur_cmd);
}
break;
+
case if_int_code:
case if_dim_code:
{
scan_int();
else
scan_dimen(false, false, false);
+
n = cur_val;
- do {
- get_x_token();
- } while(!(cur_cmd != spacer));
+ do
+ {
+ get_x_token();
+ }
+ while(!(cur_cmd != spacer));
- if ((cur_tok >= 3132) && (cur_tok <= 3134))
- r = cur_tok - 3072;
+ if ((cur_tok >= other_token + '<') && (cur_tok <= other_token + '>'))
+ r = cur_tok - other_token;
else
{
print_err("Missing = inserted for ");
back_error();
r = '=';
}
+
if (thisif == if_int_code)
scan_int();
else
scan_dimen(false, false, false);
+
switch (r)
{
case '<':
b = (n < cur_val);
break;
+
case '=':
b = (n == cur_val);
break;
+
case '>':
b = (n > cur_val);
break;
}
}
break;
+
case if_odd_code:
scan_int();
b = odd(cur_val);
break;
+
case if_vmode_code:
b = (abs(mode) == 1);
break;
+
case if_hmode_code:
b = (abs(mode) == 102);
break;
+
case if_mmode_code:
b = (abs(mode) == 203);
break;
+
case if_inner_code:
b = (mode < 0);
break;
+
case if_void_code:
case if_hbox_code:
case if_vbox_code:
{
scan_eight_bit_int();
p = box(cur_val);
+
if (thisif == if_void_code)
b = (p == 0);
else if (p == 0)
b = (type(p) == vlist_node);
}
break;
+
case ifx_code:
{
savescannerstatus = scanner_status;
p = cur_cmd;
q = cur_chr;
get_next();
+
if (cur_cmd != p)
b = false;
else if (cur_cmd < call)
{
p = link(cur_chr);
q = link(equiv(n));
+
if (p == q)
b = true;
else
p = link(p);
q = link(q);
}
+
b = ((p == 0) && (q == 0));
}
}
+
scanner_status = savescannerstatus;
}
break;
+
case if_eof_code:
{
scan_four_bit_int();
- b = (read_open[cur_val] == 2);
+ b = (read_open[cur_val] == closed);
}
break;
+
case if_true_code:
b = true;
break;
+
case if_false_code:
b = false;
break;
+
case if_case_code:
{
scan_int();
n = cur_val;
+
if (tracing_commands > 1)
{
begin_diagnostic();
print_char('}');
end_diagnostic(false);
}
- while (n != 0) {
+
+ while (n != 0)
+ {
pass_text();
+
if (cond_ptr == savecondptr)
if (cur_chr == or_code)
decr(n);
free_node(p, if_node_size);
}
}
+
change_if_limit(or_code, savecondptr);
return;
}
break;
}
+
if (tracing_commands > 1)
{
begin_diagnostic();
+
if (b)
print_string("{true}");
else
print_string("{false}");
+
end_diagnostic(false);
}
+
if (b) /* b may be used without ... */
{
change_if_limit(else_code, savecondptr);
return;
}
- while (true) {
+
+ while (true)
+ {
pass_text();
+
if (cond_ptr == savecondptr)
{
if (cur_chr != or_code)
goto lab50;
+
print_err("Extra ");
print_esc("or");
help1("I'm ignoring this; it doesn't match any \\if.");
free_node(p, if_node_size);
}
}
+
lab50:
if (cur_chr == fi_code)
{
if (trace_flag)
{
- sprintf(log_line, "\nLOOKING for string (str_ptr %d nlen %d) ", str_ptr, end-start);
+ sprintf(log_line, "\nLOOKING for string (str_ptr %d nlen %d) ", str_ptr, end - start);
s = log_line + strlen(log_line);
strncpy(s, (const char *) str_pool + start, nlen);
- strcpy(s+nlen, "");
+ strcpy(s + nlen, "");
show_line(log_line, 0);
}
// code in new_font (tex8.c) will take care of reuse of font name already
for (k = 0; k < str_ptr - 1; k++)
{
- if (length(k) != nlen) continue;
+ if (length(k) != nlen)
+ continue;
+
if (strncmp((const char *) str_pool + start, (const char *) str_pool + str_start[k], nlen) == 0)
{
if (trace_flag)
sprintf(log_line, "\nNOT FOUND string ");
s = log_line + strlen(log_line);
strncpy(s, (const char*)str_pool + start, nlen);
- strcpy(s+nlen, "\n");
+ strcpy(s + nlen, "\n");
show_line(log_line, 0);
}
if (trace_flag)
{
- int n = end-start;
+ int n = end - start;
sprintf(log_line, "\nSTRIPPING OUT %d %d ", n, nlen);
s = log_line + strlen(log_line);
strncpy(s, (const char *)str_pool + start, n);
- strcpy(s+n, "\n");
+ strcpy(s + n, "\n");
show_line(log_line, 0);
}
if (nlen > 0)
- memcpy(str_pool+start, str_pool+end, nlen);
+ memcpy(str_pool + start, str_pool + end, nlen);
pool_ptr = start + nlen; // poolprt - (end-start);
}
void show_string (int k)
-{ // debugging code
+{
int nlen = length(k);
char *s;
show_line(log_line, 0);
}
-// debugging code
void show_all_strings (void)
{
int k;
integer k;
ASCII_code c;
pool_pointer j;
+
k = 0;
for (j = str_start[a]; j <= str_start[a + 1] - 1; j++)
{
c = str_pool[j];
incr(k);
+
if (k <= PATHMAX)
name_of_file[k] = xchr[c];
}
+
for (j = str_start[n]; j <= str_start[n + 1] - 1; j++)
{
c = str_pool[j];
incr(k);
+
if (k <= PATHMAX)
name_of_file[k] = xchr[c];
}
+
for (j = str_start[e]; j <= str_start[e + 1] - 1; j++)
{
c = str_pool[j];
incr(k);
+
if (k <= PATHMAX)
name_of_file[k] = xchr[c];
}
name_length = k;
else
name_length = PATHMAX - 1;
+
/* pad it out with spaces ... what for ? in case we modify and forget ? */
- for (k = name_length + 1; k <= PATHMAX; k++) name_of_file[k]= ' ';
- name_of_file[PATHMAX]= '\0'; /* paranoia 94/Mar/24 */
+ for (k = name_length + 1; k <= PATHMAX; k++)
+ name_of_file[k] = ' ';
+
+ name_of_file[PATHMAX] = '\0'; /* paranoia 94/Mar/24 */
+
{
name_of_file [name_length+1] = '\0';
+
if (trace_flag)
{
sprintf(log_line, " pack_file_name `%s' (%d) ", name_of_file + 1, name_length); /* debugging */
show_line(log_line, 0);
}
+
name_of_file [name_length + 1] = ' ';
}
}
integer k;
ASCII_code c;
integer j;
+
if (n + b - a + 5 > PATHMAX)
b = a + PATHMAX - n - 5;
+
k = 0;
+
/* This loop kicks in when we want the default format name */
for (j = 1; j <= n; j++)
{
c = xord[TEX_format_default[j]];
incr(k);
+
if (k <= PATHMAX)
name_of_file[k] = xchr[c];
}
{
c = buffer[j];
incr(k);
+
if (k <= PATHMAX)
name_of_file[k] = xchr[c];
}
+
/* This adds the extension from the default format name */
for (j = format_default_length - 3; j <= format_default_length; j++)
{
c = xord[TEX_format_default[j]];
incr(k);
+
if (k <= PATHMAX)
name_of_file[k] = xchr[c];
}
+
if (k < PATHMAX)
name_length = k;
else
name_length = PATHMAX - 1;
-/* pad it out with spaces ... what for ? */
+
+ /* pad it out with spaces ... what for ? */
for (k = name_length + 1; k <= PATHMAX; k++)
name_of_file[k]= ' ';
- name_of_file[PATHMAX]= '\0'; /* paranoia 94/Mar/24 */
+
+ name_of_file[PATHMAX] = '\0'; /* paranoia 94/Mar/24 */
}
/* sec 0525 */
str_number make_name_string (void)
if (v != NULL)
{
t = v;
+
while (*t > '\0')
print_char(*t++);
}
+
print_char(')');
}
}
}
- while (true) {
+ while (true)
+ {
if (k == last)
goto lab30;
/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
if (!more_name(buffer[k]))
goto lab30;
+
incr(k);
}
lab30:
texmf_log_name = a_make_name_string(log_file);
selector = log_only;
log_opened = true;
+
{
/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
-// for our version DOS/Windows
if (want_version)
{
stamp_it(log_line); // ??? use log_line ???
void start_input (void)
{
bool addedextension = false;
+
scan_file_name();
pack_file_name(cur_name, cur_area, cur_ext);
- while (true) { /* loop until we get a valid file name */
+ while (true) /* loop until we get a valid file name */
+ {
addedextension = false;
begin_file_reading();
/* *** *** *** *** *** following is new in 3.14159 *** *** *** *** *** *** */
/* if current extension is *not* empty, try to open using name as is */
/* string 335 is "" the empty string */
+/* should be updated to current Kpathsea. */
if ((cur_ext != 335) && a_open_in(input_file[cur_input.index_field], TEXINPUTPATH))
goto lab30;
/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
/* string 785 is .tex */
/* (! extensionirrelevantp(name_of_file, "tex"))){ */
if ((cur_ext != 785) && (name_length + 5 < PATHMAX) &&
- (! extensionirrelevantp(name_of_file, name_length, "tex")))
+ (!extensionirrelevantp(name_of_file, name_length, "tex")))
{
+ //strcpy(name_of_file + name_length + 1, ".tex ");
name_of_file[name_length + 1] = '.';
name_of_file[name_length + 2] = 't';
name_of_file[name_length + 3] = 'e';
name_of_file[name_length + 4] = 'x';
- name_of_file[name_length + 5] = ' '; /* 96/Jan/20 ??? */
+ name_of_file[name_length + 5] = ' ';
name_length = name_length + 4;
addedextension = true;
-/* *** *** *** *** following new in 3.14159 *** *** *** *** *** *** *** */
+
if (a_open_in(input_file[cur_input.index_field], TEXINPUTPATH))
goto lab30;
/* did file name have an `extension' already and we added ".tex" ? */
if (cur_ext != 335 && addedextension) /* 98/Feb/7 */
jobnameappend(); /* append `extension' to job_name */
+
open_log_file();
}
+
if (term_offset + length(cur_input.name_field) > max_print_line - 2) /* was 3 ? */
print_ln();
else if ((term_offset > 0) || (file_offset > 0))
print_char(' ');
+
print_char('(');
-// print_char(64); // debugging only marker
+// print_char('@'); // debugging only marker
incr(open_parens);
+
if (open_parens > max_open_parens)
max_open_parens = open_parens; /* 1999/Jan/17 */
+
slow_print(cur_input.name_field);
-// print_char(64); // debugging only marker
+// print_char('@'); // debugging only marker
#ifndef _WINDOWS
fflush(stdout);
#endif
cur_input.state_field = new_line;
+
{
line = 1;
+
if (input_ln(input_file[cur_input.index_field], false));
+
firm_up_the_line();
+
if ((end_line_char < 0) || (end_line_char > 255))
decr(cur_input.limit_field);
else
buffer[cur_input.limit_field] = end_line_char;
+
first = cur_input.limit_field + 1;
cur_input.loc_field = cur_input.start_field;
}
{ /* 98/Jan/28 */
char *s, *t, *v, *u;
int n;
+
s = "TEXFONTS";
- if (encoding_specific) {
+
+ if (encoding_specific)
+ {
u = encoding_name; /* try specific */
- if ((t = grabenv(u)) != NULL) {
- if (strchr(t, ':') != NULL &&
- sscanf(t, "%d", &n) == 0) {
+
+ if ((t = grabenv(u)) != NULL)
+ {
+ if (strchr(t, ':') != NULL && sscanf(t, "%d", &n) == 0)
+ {
s = u; /* look here instead of TEXFONTS=... */
}
}
}
+
print_nl(" ");
print_char(' ');
print_char('(');
t = s;
- while (*t > '\0') print_char(*t++);
+
+ while (*t > '\0')
+ print_char(*t++);
+
print_char('=');
v = grabenv(s);
- if (v != NULL) {
+
+ if (v != NULL)
+ {
t = v;
- while (*t > '\0') print_char(*t++);
+
+ while (*t > '\0')
+ print_char(*t++);
}
+
print_char(')');
}
/* sec 0560 */
internal_font_number read_font_info_(halfword u, str_number nom, str_number aire, scaled s)
{
- register internal_font_number Result;
font_index k;
bool fileopened;
/* halfword lf, lh, bc, ec, nw, nh, nd, ni, nl, nk, ne, np; */
if (!b_open_in(tfm_file))
goto lab11;
}
- else goto lab11;
+ else
+ goto lab11;
}
/* was just: goto lab11; */
fileopened = true;
italic_base[f] = depth_base[f] + nd;
lig_kern_base[f] = italic_base[f] + ni;
kern_base[f] = lig_kern_base[f] + nl - 256 * (128);
- exten_base[f] = kern_base[f] + 256 *(128) + nk;
+ exten_base[f] = kern_base[f] + 256 * (128) + nk;
param_base[f] = exten_base[f] + ne;
{
z = s;
else
z = xn_over_d(z, - (integer) s, 1000);
+
font_size[f] = z;
}
if (d >= nl)
goto lab11;
break;
+
case 3 :
if (d >= ne)
goto lab11;
break;
+
case 2 :
{
{
if ((d < bc)||(d > ec))
goto lab11;
}
- while (d < k + bc - fmem_ptr) {
+
+ while (d < k + bc - fmem_ptr)
+ {
qw = font_info[char_base[f]+ d].qqqq;
+
if (((qw.b2)% 4)!= 2)
goto lab45;
+
d = qw.b3;
}
+
if (d == k + bc - fmem_ptr)
goto lab11;
lab45:;
}
break;
+
default:
break;
}
{
{
alpha = 16;
- while (z >= 8388608L) { /* 2^23 */
+
+ while (z >= 8388608L) /* 2^23 */
+ {
z = z / 2;
alpha = alpha + alpha;
}
+
beta = (char) (256 / alpha);
alpha = alpha * z;
}
tfm_temp = getc(tfm_file);
d = tfm_temp;
sw = (((((d * z) / 256) + (c * z)) / 256) + (b * z)) / beta;
+
if (a == 0)
font_info[k].cint = sw;
else if (a == 255)
else
goto lab11;
}
+
if (font_info[width_base[f]].cint != 0)
goto lab11;
+
if (font_info[height_base[f]].cint != 0)
goto lab11;
+
if (font_info[depth_base[f]].cint != 0)
goto lab11;
+
if (font_info[italic_base[f]].cint != 0)
goto lab11;
}
if (nl > 0)
{
- for (k = lig_kern_base[f]; k <= kern_base[f] + 256 * (128)- 1; k++)
+ for (k = lig_kern_base[f]; k <= kern_base[f] + 256 * (128) - 1; k++)
{
{
tfm_temp = getc(tfm_file);
qw.b3 = d;
font_info[k].qqqq = qw; /* store_four_quarters(font_info[k].qqqq */
}
+
if (a > 128)
{
if (256 * c + d >= nl)
goto lab11; /* error in TFM, abort */
+
if (a == 255)
if (k == lig_kern_base[f])
bchar = b;
if ((b < bc) || (b > ec)) /* check-existence(b) */
goto lab11; /* error in TFM, abort */
}
+
qw = font_info[char_base[f] + b].qqqq;
+
if (!(qw.b0 > 0))
goto lab11; /* error in TFM, abort */
}
+
if (c < 128)
{
{
if ((d < bc) || (d > ec)) /* check-existence(d) */
goto lab11; /* error in TFM, abort */
}
+
qw = font_info[char_base[f] + d].qqqq;
+
if (!(qw.b0 > 0))
goto lab11; /* error in TFM, abort */
}
goto lab11; /* error in TFM, abort */
}
}
+
if (a == 255)
bchlabel = 256 * c + d;
}
tfm_temp = getc(tfm_file);
d = tfm_temp;
sw = (((((d * z) / 256) + (c * z)) / 256) + (b * z)) / beta;
+
if (a == 0)
font_info[k].cint = sw;
else if (a == 255)
/* store_four_quarters(font_info[k].qqqq); */
font_info[k].qqqq = qw;
}
+
if (a != 0)
{
{
if ((a < bc) || (a > ec))
goto lab11;
}
+
qw = font_info[char_base[f] + a].qqqq;
+
if (!(qw.b0 > 0))
goto lab11;
}
+
if (b != 0)
{
{
if ((b < bc) || (b > ec))
goto lab11;
}
+
qw = font_info[char_base[f] + b].qqqq;
+
if (!(qw.b0 > 0))
goto lab11;
}
+
if (c != 0)
{
{
if ((c < bc) || (c > ec))
goto lab11;
}
+
qw = font_info[char_base[f] + c].qqqq;
+
if (!(qw.b0 > 0))
goto lab11;
}
if ((d < bc) || (d > ec))
goto lab11;
}
+
qw = font_info[char_base[f] + d].qqqq;
+
if (!(qw.b0 > 0))
goto lab11;
}
{
tfm_temp = getc(tfm_file);
sw = tfm_temp;
+
if (sw > 127)
sw = sw - 256;
+
tfm_temp = getc(tfm_file);
sw = sw * 256 + tfm_temp;
tfm_temp = getc(tfm_file);
tfm_temp = getc(tfm_file);
d = tfm_temp;
sw = (((((d * z) / 256) + (c * z)) / 256) + (b * z)) / beta;
+
if (a == 0)
font_info[param_base[f] + k - 1].cint = sw;
else if (a == 255)
/* use test_eof() here instead ? */
if (feof(tfm_file))
goto lab11;
+
for (k = np + 1; k <= 7; k++)
font_info[param_base[f] + k - 1].cint = 0;
}
font_params[f] = np;
else
font_params[f] = 7;
+
hyphen_char[f] = default_hyphen_char;
skew_char[f] = default_skew_char;
+
if (bchlabel < nl)
bchar_label[f] = bchlabel + lig_kern_base[f];
else
bchar_label[f]= non_address; /* i.e. 0 --- 96/Jan/15 */
+
font_bchar[f] = bchar;
font_false_bchar[f] = bchar;
+
if (bchar <= ec)
if (bchar >= bc)
{
qw = font_info[char_base[f] + bchar].qqqq;
+
if ((qw.b0 > 0))
font_false_bchar[f] = 256;
}
+
font_name[f] = nom;
font_area[f] = aire;
font_bc[f] = bc;
sprint_cs(u);
print_char('=');
print_file_name(nom, aire, 335); /* "" */
+
if (s >= 0)
{
print_string(" at ");
if (aire == 335) /* "" only if path not specified */
{
- if (show_texinput_flag) show_tex_fonts(); /* 98/Jan/31 */
+ if (show_texinput_flag)
+ show_tex_fonts(); /* 98/Jan/31 */
}
help5("I wasn't able to read the size data for this font,",
if (fileopened)
b_close(tfm_file);
- Result = g;
- return Result;
+ return g;
}
\ No newline at end of file
{
if (tracing_lost_chars > 0)
{
-/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
- if (show_missing == 0) /* show on screen 94/June/10 */
-/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
+ if (show_missing == 0)
begin_diagnostic();
-/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
- if (show_missing)
- { /* add ! before 94/June/10 */
+
+ if (show_missing) /* add ! before 94/June/10 */
+ {
print_nl("! ");
print_string("Missing character: there is no ");
}
else
print_nl("Missing character: there is no ");
+
print(c);
-/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
- if (show_numeric)
- { /* bkph 93/Dec/21 */
+
+ if (show_numeric) /* bkph 93/Dec/21 */
+ {
print_char(' ');
print_char('(');
+
if (c / 100 > 0)
{
print_char(48 + c / 100);
/* if (show_missing) show_context(); */ /* in tex2.c 94/June/10 */
if (show_missing)
{
- if (f != 0) show_context(); /* not if its the nullfont */
+ if (f != 0)
+ show_context(); /* not if its the nullfont */
}
+
if (show_missing == 0) /* show on screen 94/June/10 */
-/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
end_diagnostic(false);
-/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
+
missing_characters++; /* bkph 93/Dec/16 */
/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
}
/* sec 0582 */
halfword new_character_(internal_font_number f, eight_bits c)
{
- register halfword Result;
halfword p;
+
if (font_bc[f] <= c)
if (font_ec[f] >= c)
if ((font_info[char_base[f] + c].qqqq.b0 > 0))
p = get_avail();
font(p) = f;
character(p) = c;
- Result = p;
- return (Result);
+ return p;
}
+
char_warning(f, c); /* char_warning(f,c); l.11283 */
- Result = 0; /* new_character:=null */
- return Result;
+ return 0;
}
/* following needs access to dvi_buf=zdvibuf see coerce.h */
/* sec 0598 */
if (dvi_limit == dvi_buf_size)
{
- writedvi(0, half_buf - 1);
+ write_dvi(0, half_buf - 1);
dvi_limit = half_buf;
dvi_offset = dvi_offset + dvi_buf_size;
dvi_ptr = 0;
}
else
{
- writedvi(half_buf, dvi_buf_size - 1);
+ write_dvi(half_buf, dvi_buf_size - 1);
dvi_limit = dvi_buf_size;
}
+
dvi_gone = dvi_gone + half_buf;
}
/* following needs access to dvi_buf=zdvibuf see coerce.h */
void dvi_font_def_(internal_font_number f)
{
pool_pointer k;
-/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
+
#ifdef INCREASEFONTS
if (f <= 256)
{
- dvi_out(243);
+ dvi_out(fnt_def1);
dvi_out(f - 1);
}
else
{
- dvi_out(244);
+ dvi_out(fnt_def2);
dvi_out(((f - 1) >> 8));
dvi_out(((f - 1) & 255));
}
#else
- dvi_out(243);
+ dvi_out(fnt_def1);
dvi_out(f - 1);
#endif
/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
dvi_four(font_dsize[f]);
dvi_out(length(font_area[f]));
dvi_out(length(font_name[f]));
-/* sec 0603 */
- for (k = str_start[font_area[f]]; k <= str_start[font_area[f]+ 1] - 1; k++)
+
+ for (k = str_start[font_area[f]]; k <= str_start[font_area[f] + 1] - 1; k++)
dvi_out(str_pool[k]);
- for (k = str_start[font_name[f]]; k <= str_start[font_name[f]+ 1] - 1; k++)
+
+ for (k = str_start[font_name[f]]; k <= str_start[font_name[f] + 1] - 1; k++)
dvi_out(str_pool[k]);
}
/* following needs access to dvi_buf=zdvibuf see coerce.h */
small_number mstate;
halfword p, q;
integer k;
- q = get_node(3);
- mem[q + 1].cint = w;
- mem[q + 2].cint = dvi_offset + dvi_ptr;
- if (o == 157) /* 157 == down1 */
+
+ q = get_node(movement_node_size);
+ width(q) = w;
+ location(q) = dvi_offset + dvi_ptr;
+
+ if (o == down1)
{
- mem[q].hh.v.RH = down_ptr;
+ link(q) = down_ptr;
down_ptr = q;
}
else
- { /* 143 == right1 */
- mem[q].hh.v.RH = right_ptr;
+ {
+ link(q) = right_ptr;
right_ptr = q;
}
- p = mem[q].hh.v.RH;
- mstate = 0;
- while (p != 0) { /* while p<>null do l.12153 */
- if (mem[p + 1].cint == w)
- switch(mstate + mem[p].hh.v.LH)
+
+ p = link(q);
+ mstate = none_seen;
+
+ while (p != 0)
+ {
+ if (width(p) == w)
+ switch(mstate + info(p))
{
- case 3:
- case 4:
- case 15:
- case 16:
- if (mem[p + 2].cint < dvi_gone)
+ case none_seen + yz_OK:
+ case none_seen + y_OK:
+ case z_seen + yz_OK:
+ case z_seen + y_OK:
+ if (location(p) < dvi_gone)
goto lab45;
else
{
- k = mem[p + 2].cint - dvi_offset;
+ k = location(p) - dvi_offset;
+
if (k < 0)
k = k + dvi_buf_size;
- dvi_buf[k]= dvi_buf[k] + 5;
- mem[p].hh.v.LH = 1;
+
+ dvi_buf[k] = dvi_buf[k] + y1 - down1;
+ info(p) = y_here;
goto lab40;
}
break;
- case 5:
- case 9:
- case 11:
- if (mem[p + 2].cint < dvi_gone)
+
+ case none_seen + z_OK:
+ case y_seen + yz_OK:
+ case y_seen + z_OK:
+ if (location(p) < dvi_gone)
goto lab45;
else
{
- k = mem[p + 2].cint - dvi_offset;
+ k = location(p) - dvi_offset;
+
if (k < 0)
k = k + dvi_buf_size;
- dvi_buf[k]= dvi_buf[k] + 10;
- mem[p].hh.v.LH = 2;
+
+ dvi_buf[k] = dvi_buf[k] + z1 - down1;
+ info(p) = z_here;
goto lab40;
}
break;
- case 1:
- case 2:
- case 8:
- case 13:
+
+ case none_seen + y_here:
+ case none_seen + z_here:
+ case y_seen + z_here:
+ case z_seen + y_here:
goto lab40;
break;
+
default:
break;
}
- else switch (mstate + mem[p].hh.v.LH)
+ else switch (mstate + info(p))
{
- case 1:
- mstate = 6;
+ case none_seen + y_here:
+ mstate = y_seen;
break;
- case 2:
- mstate = 12;
+
+ case none_seen + z_here:
+ mstate = z_seen;
break;
- case 8:
- case 13:
+
+ case y_seen + z_here:
+ case z_seen + y_here:
goto lab45;
break;
+
default:
break;
}
- p = mem[p].hh.v.RH;
+ p = link(p);
}
lab45:
- ;
- mem[q].hh.v.LH = 3;
+
+ info(q) = yz_OK;
+
if (abs(w) >= 8388608L) /* 2^23 */
{
dvi_out(o + 3);
dvi_four(w);
return;
}
+
if (abs(w) >= 32768L)
{
dvi_out(o + 2);
+
if (w < 0)
w = w + 16777216L; /* 2^24 */
//dvi_out(w / 65536L);
w = w & 65535L;
goto lab2;
}
+
if (abs(w)>= 128)
{
dvi_out(o + 1);
+
if (w < 0)
w = w + 65536L;
+
goto lab2;
}
+
dvi_out(o);
+
if (w < 0)
w = w + 256;
+
goto lab1;
lab2:
//dvi_out(w / 256);
dvi_out(w & 255);
return;
lab40:
- mem[q].hh.v.LH = mem[p].hh.v.LH;
- if (mem[q].hh.v.LH == 1)
+ info(q) = info(p);
+
+ if (info(q) == y_here)
{
- dvi_out(o + 4);
- while (mem[q].hh.v.RH != p) {
- q = mem[q].hh.v.RH;
- switch (mem[q].hh.v.LH)
+ dvi_out(o + y0 - down1);
+
+ while (link(q) != p)
+ {
+ q = link(q);
+
+ switch (info(q))
{
- case 3:
- mem[q].hh.v.LH = 5;
+ case yz_OK:
+ info(q) = z_OK;
break;
- case 4:
- mem[q].hh.v.LH = 6;
+
+ case y_OK:
+ info(q) = d_fixed;
break;
+
default:
break;
}
}
else
{
- dvi_out(o + 9);
- while (mem[q].hh.v.RH != p) {
- q = mem[q].hh.v.RH;
- switch (mem[q].hh.v.LH)
+ dvi_out(o + z0 - down1);
+
+ while (link(q) != p)
+ {
+ q = link(q);
+
+ switch (info(q))
{
- case 3:
- mem[q].hh.v.LH = 4;
+ case yz_OK:
+ info(q) = y_OK;
break;
- case 5:
- mem[q].hh.v.LH = 6;
+
+ case z_OK:
+ info(q) = d_fixed;
break;
+
default:
break;
}
void prune_movements_(integer l)
{
halfword p;
+
while (down_ptr != 0)
{
- if (mem[down_ptr + 2].cint < l)
+ if (location(down_ptr) < l)
goto lab30;
+
p = down_ptr;
- down_ptr = mem[p].hh.v.RH;
- free_node(p, 3);
+ down_ptr = link(p);
+ free_node(p, movement_node_size);
}
lab30:
while (right_ptr != 0)
{
- if (mem[right_ptr + 2].cint < l)
+ if (location(right_ptr) < l)
return;
+
p = right_ptr;
- right_ptr = mem[p].hh.v.RH;
- free_node(p, 3);
+ right_ptr = link(p);
+ free_node(p, movement_node_size);
}
}
/* following needs access to dvi_buf=zdvibuf see coerce.h */
if (cur_h != dvi_h)
{
- movement(cur_h - dvi_h, 143); /* 143 == right1 */
+ movement(cur_h - dvi_h, right1);
dvi_h = cur_h;
}
if (cur_v != dvi_v)
{
- movement(cur_v - dvi_v, 157); /* 157 == down1 */
+ movement(cur_v - dvi_v, down1);
dvi_v = cur_v;
}
+
old_setting = selector;
selector = new_string;
+
/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
/* About output \special{...} make some space in string pool 97/Mar/9 */
#ifdef ALLOCATESTRING
/* Fixed 97/Mar/9 in version 2.0.3 */
/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
#ifdef ALLOCATESTRING
-/* show_token_list(mem[mem[p + 1].hh.v.RH].hh.v.RH, 0,
- current_pool_size - pool_ptr); */
- show_token_list(mem[mem[p + 1].hh.v.RH].hh.v.RH, 0, 10000000L);
+ show_token_list(link(write_tokens(p)), 0, 10000000L);
/* Above is safe, since print/print_char/print_esc will extend string space */
#else
/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
- show_token_list(mem[mem[p + 1].hh.v.RH].hh.v.RH, 0, pool_size - pool_ptr);
+ show_token_list(link(write_tokens(p)), 0, pool_size - pool_ptr);
#endif
selector = old_setting;
str_room(1);
if (cur_length < 256) /* can use xxx1 ? */
{
- dvi_out(239);
-/* long to unsigned char ... */
+ dvi_out(xxx1);
dvi_out(cur_length);
}
else
- { /* use xxx4 instead */
- dvi_out(242);
+ {
+ dvi_out(xxx4);
dvi_four(cur_length);
}
{
int k = str_start[str_ptr];
int kend = pool_ptr;
- if (kend > k + 4) {
- if (str_pool [k] == 's' &&
- str_pool [k+1] == 'r' &&
- str_pool [k+2] == 'c' &&
- str_pool [k+3] == ':') { /* \special{src: ... } */
+ /* \special{src: ... } */
+ if (kend > k + 4)
+ {
+ if (str_pool [k] == 's' && str_pool [k + 1] == 'r' && str_pool [k + 2] == 'c' && str_pool [k + 3] == ':')
+ {
show_char('\n');
s = log_line;
- while (k < kend) {
+
+ while (k < kend)
+ {
*s++ = str_pool[k++];
}
+
*s++ = ' ';
*s++ = '\0';
show_line(log_line, 0)
#ifndef _WINDOWS
fflush(stdout);
#endif
- if (cur_input.name_field > 17) { /* redundant ? */
+ if (cur_input.name_field > 17) /* redundant ? */
+ {
print(cur_input.name_field);
print_char('(');
print_int(line); /* line number */
/* small_number j; */
int j; /* 1995/Jan/7 */
halfword q, r;
-/* q:=get_avail; info(q):=right_brace_token+"}";@/ */
+
q = get_avail();
- info(q) = 637;
-/* r:=get_avail; link(q):=r; info(r):=end_write_token; ins_list(q);@/ */
-/* @d end_write_token==cs_token_flag+end_write */
+ info(q) = right_brace_token + '}';
r = get_avail();
link(q) = r;
-/* mem[r].hh.v.LH = (hash_size + 4617); */
-/* mem[r].hh.v.LH = (hash_size + 4095 + 522); */
- info(r) = (hash_size + hash_extra + 4095 + 522);
- begin_token_list(q, 4);
- begin_token_list(mem[p + 1].hh.v.RH, 15);
+ info(r) = end_write_token;
+ ins_list(q);
+ begin_token_list(write_tokens(p), write_text);
q = get_avail();
- mem[q].hh.v.LH = 379;
- begin_token_list(q, 4);
+ info(q) = left_brace_token + '{';
+ ins_list(q);
oldmode = mode;
mode = 0;
cur_cs = write_loc;
q = scan_toks(false, true);
get_token();
-/* if (cur_tok != (hash_size + 4617)) */
-/* if (cur_tok != (hash_size + 4095 + 522)) */
- if (cur_tok != (hash_size + hash_extra + 4095 + 522))
+
+ if (cur_tok != end_write_token)
{
print_err("Unbalanced write command");
help2("On this page there's a \\write with fewer real {'s than }'s.",
"I can't handle that very well; good luck.");
error();
+
do
- {
- get_token();
- }
- while(!(cur_tok == (hash_size + hash_extra + 4095 + 522))); /*1996/Jan/10*/
+ {
+ get_token();
+ }
+ while(!(cur_tok == end_write_token)); /*1996/Jan/10*/
}
+
mode = oldmode;
end_token_list();
old_setting = selector;
- j = mem[p + 1].hh.v.LH;
+ j = write_stream(p);
+
if (write_open[j])
selector = j;
else
{
- if ((j == 17) && (selector == 19))
- selector = 18;
+ if ((j == 17) && (selector == term_and_log))
+ selector = log_only;
+
print_nl("");
}
+
token_show(def_ref);
print_ln();
flush_list(def_ref);
{
/* small_number j; */
int j; /* 1995/Jan/7 */
- switch(mem[p].hh.b1)
- {case 0 :
- case 1 :
- case 2 :
- if (!doing_leaders) {
- j = mem[p + 1].hh.v.LH;
- if (mem[p].hh.b1 == 1){
- write_out(p);
- } else {
- if (write_open[j])
- (void) a_close(write_file[j]);
- if (mem[p].hh.b1 == 2)
- write_open[j]= false;
- else if (j < 16){
- cur_name = mem[p + 1].hh.v.RH;
- cur_area = mem[p + 2].hh.v.LH;
- cur_ext = mem[p + 2].hh.v.RH;
- if (cur_ext == 335) /* "" */
- cur_ext = 785; /* => ".tex" */
- pack_file_name(cur_name, cur_area, cur_ext);
- while(! a_open_out(write_file[j])) {
- prompt_file_name("output file name", ".tex");
- }
- write_open[j]= true;
- }
- }
- }
- break;
- case 3 :
- special_out(p);
- break;
- case 4 :
- ;
- break;
- default:
- {
- confusion("ext4");
- return; // abort_flag set
- }
- break;
- }
-}
+
+ switch (subtype(p))
+ {
+ case open_node:
+ case write_node:
+ case close_node:
+ if (!doing_leaders)
+ {
+ j = write_stream(p);
+
+ if (subtype(p) == write_node)
+ {
+ write_out(p);
+ }
+ else
+ {
+ if (write_open[j])
+ (void) a_close(write_file[j]);
+
+ if (subtype(p) == close_node)
+ write_open[j]= false;
+ else if (j < 16)
+ {
+ cur_name = open_name(p);
+ cur_area = open_area(p);
+ cur_ext = open_ext(p);
+
+ if (cur_ext == 335) /* "" */
+ cur_ext = 785; /* => ".tex" */
+
+ pack_file_name(cur_name, cur_area, cur_ext);
+
+ while(! a_open_out(write_file[j]))
+ {
+ prompt_file_name("output file name", ".tex");
+ }
+
+ write_open[j] = true;
+ }
+ }
+ }
+ break;
+
+ case special_node:
+ special_out(p);
+ break;
+
+ case language_node:
+ ;
+ break;
+
+ default:
+ {
+ confusion("ext4");
+ return; // abort_flag set
+ }
+ break;
+ }
+}
/* following needs access to dvi_buf=zdvibuf see coerce.h */
/* sec 0619 */
void hlist_out (void)
{
- scaled baseline;
- scaled leftedge;
- scaled saveh, savev;
- halfword thisbox;
-/* glue_ord gorder; */
- int gorder; /* 95/Jan/7 */
-/* char gsign; */
- int gsign; /* 95/Jan/7 */
+ scaled base_line;
+ scaled left_edge;
+ scaled save_h, save_v;
+ halfword this_box;
+/* glue_ord g_order; */
+ int g_order; /* 95/Jan/7 */
+/* char g_sign; */
+ int g_sign; /* 95/Jan/7 */
halfword p;
- integer saveloc;
- halfword leaderbox;
- scaled leaderwd;
+ integer save_loc;
+ halfword leader_box;
+ scaled leader_wd;
scaled lx;
- bool outerdoingleaders;
+ bool outer_doing_leaders;
scaled edge;
- real gluetemp;
+ real glue_temp;
real cur_glue;
scaled cur_g;
cur_g = 0;
cur_glue = 0.0;
- thisbox = temp_ptr;
- gorder = glue_order(thisbox);
- gsign = glue_sign(thisbox);
- p = list_ptr(thisbox);
+ this_box = temp_ptr;
+ g_order = glue_order(this_box);
+ g_sign = glue_sign(this_box);
+ p = list_ptr(this_box);
incr(cur_s);
+
if (cur_s > 0)
dvi_out(141);
+
if (cur_s > max_push)
max_push = cur_s;
- saveloc = dvi_offset + dvi_ptr;
- baseline = cur_v;
- leftedge = cur_h;
-/* while p<>null do l.12314 */
- while(p != 0)
+
+ save_loc = dvi_offset + dvi_ptr;
+ base_line = cur_v;
+ left_edge = cur_h;
+
+ while (p != 0)
lab21:
- if (is_char_node(p))
- {
- if (cur_h != dvi_h)
- {
- movement(cur_h - dvi_h, 143); /* 143 == right1 */
- dvi_h = cur_h;
- }
- if (cur_v != dvi_v)
- {
- movement(cur_v - dvi_v, 157); /* 157 == down1 */
- dvi_v = cur_v;
- }
- do
+ if (is_char_node(p))
{
- f = font(p);
- c = character(p);
- if (f != dvi_f)
+ if (cur_h != dvi_h)
+ {
+ movement(cur_h - dvi_h, right1);
+ dvi_h = cur_h;
+ }
+
+ if (cur_v != dvi_v)
{
- if (!font_used[f])
+ movement(cur_v - dvi_v, down1);
+ dvi_v = cur_v;
+ }
+
+ do
{
- dvi_font_def(f);
- font_used[f] = true;
- }
- if (f <= 64)
- dvi_out(f + 170); /* fnt_num_0 --- fnt_num_63 */
+ f = font(p);
+ c = character(p);
+
+ if (f != dvi_f)
+ {
+ if (!font_used[f])
+ {
+ dvi_font_def(f);
+ font_used[f] = true;
+ }
+
+ if (f <= 64 + font_base)
+ dvi_out(f - font_base - 1 + fnt_num_0); /* fnt_num_0 --- fnt_num_63 */
/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
#ifdef INCREASEFONTS
- /* if we allow greater than 256 fonts */
- else if (f <= 256)
- {
- dvi_out(235); /* fnt1 followed by f */
- dvi_out(f - 1);
- }
+ /* if we allow greater than 256 fonts */
+ else if (f <= 256)
+ {
+ dvi_out(fnt1);
+ dvi_out(f - 1);
+ }
#else
- /* normal TeX 82 case */
- else
- {
- dvi_out(235); /* fnt1 followed by f */
- dvi_out(f - 1);
- }
+ /* normal TeX 82 case */
+ else
+ {
+ dvi_out(fnt1);
+ dvi_out(f - 1);
+ }
#endif
/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
#ifdef INCREASEFONTS
- /* fnt2 followed by f / 256, f % 256 */
- else
- {
- dvi_out(236);
- dvi_out(((f - 1) >> 8)); /* top byte */
- dvi_out(((f - 1) & 255)); /* bottom byte */
- }
+ /* fnt2 followed by f / 256, f % 256 */
+ else
+ {
+ dvi_out(fnt2);
+ dvi_out(((f - 1) >> 8)); /* top byte */
+ dvi_out(((f - 1) & 255)); /* bottom byte */
+ }
#endif
/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
- dvi_f = f;
- }
- if (c >= 128)
- dvi_out(128);
- dvi_out(c);
- cur_h = cur_h + font_info[width_base[f] + font_info[char_base[f] + c].qqqq.b0].cint;
- p = link(p);
- } while(!(!(p >= hi_mem_min)));
- dvi_h = cur_h;
+ dvi_f = f;
+ }
+
+ if (c >= 128)
+ dvi_out(set1);
+
+ dvi_out(c);
+ cur_h = cur_h + char_width(f, char_info(f, c));
+ p = link(p);
+ }
+ while(!(!(p >= hi_mem_min)));
+ dvi_h = cur_h;
}
else
{
cur_h = cur_h + width(p);
else
{
- saveh = dvi_h;
- savev = dvi_v;
- cur_v = baseline + shift_amount(p);
+ save_h = dvi_h;
+ save_v = dvi_v;
+ cur_v = base_line + shift_amount(p);
temp_ptr = p;
edge = cur_h;
+
if (type(p) == vlist_node)
vlist_out();
else
hlist_out();
- dvi_h = saveh;
- dvi_v = savev;
+
+ dvi_h = save_h;
+ dvi_v = save_v;
cur_h = edge + width(p);
- cur_v = baseline;
+ cur_v = base_line;
}
break;
+
case rule_node:
{
rule_ht = height(p);
goto lab14;
}
break;
+
case whatsit_node:
out_what(p);
break;
+
case glue_node:
{
g = glue_ptr(p);
rule_wd = width(g) - cur_g;
- if (gsign != normal)
+
+ if (g_sign != normal)
{
- if (gsign == stretching)
+ if (g_sign == stretching)
{
- if (stretch_order(g) == gorder)
+ if (stretch_order(g) == g_order)
{
- //gluetemp = glue_set(thisbox) * stretch(g);
cur_glue = cur_glue + stretch(g);
- gluetemp = glue_set(thisbox) * cur_glue;
- if (gluetemp > 1000000000.0)
- gluetemp = 1000000000.0;
- else if (gluetemp < -1000000000.0)
- gluetemp = -1000000000.0;
- cur_g = round(gluetemp);
- //rule_wd = rule_wd + round(gluetemp);
+ glue_temp = glue_set(this_box) * cur_glue;
+
+ if (glue_temp > 1000000000.0)
+ glue_temp = 1000000000.0;
+ else if (glue_temp < -1000000000.0)
+ glue_temp = -1000000000.0;
+
+ cur_g = round(glue_temp);
}
}
- else if (shrink_order(g) == gorder)
+ else if (shrink_order(g) == g_order)
{
- //gluetemp = glue_set(thisbox) * shrink(g);
cur_glue = cur_glue - shrink(g);
- gluetemp = glue_set(thisbox) * cur_glue;
- if (gluetemp > 1000000000.0)
- gluetemp = 1000000000.0;
- else if (gluetemp < -1000000000.0)
- gluetemp = -1000000000.0;
- cur_g = round(gluetemp);
- //rule_wd = rule_wd - round(gluetemp);
+ glue_temp = glue_set(this_box) * cur_glue;
+
+ if (glue_temp > 1000000000.0)
+ glue_temp = 1000000000.0;
+ else if (glue_temp < -1000000000.0)
+ glue_temp = -1000000000.0;
+
+ cur_g = round(glue_temp);
}
}
+
rule_wd = rule_wd + cur_g;
+
if (subtype(p) >= a_leaders)
{
- leaderbox = leader_ptr(p);
- if (type(leaderbox) == rule_node)
+ leader_box = leader_ptr(p);
+
+ if (type(leader_box) == rule_node)
{
- rule_ht = height(leaderbox);
- rule_dp = depth(leaderbox);
+ rule_ht = height(leader_box);
+ rule_dp = depth(leader_box);
goto lab14;
}
- leaderwd = width(leaderbox);
- if ((leaderwd > 0) && (rule_wd > 0))
+
+ leader_wd = width(leader_box);
+
+ if ((leader_wd > 0) && (rule_wd > 0))
{
rule_wd = rule_wd + 10;
edge = cur_h + rule_wd;
lx = 0;
+
if (subtype(p) == a_leaders)
{
- saveh = cur_h;
- cur_h = leftedge + leaderwd * ((cur_h - leftedge) / leaderwd);
- if (cur_h < saveh)
- cur_h = cur_h + leaderwd;
+ save_h = cur_h;
+ cur_h = left_edge + leader_wd * ((cur_h - left_edge) / leader_wd);
+
+ if (cur_h < save_h)
+ cur_h = cur_h + leader_wd;
}
else
{
- lq = rule_wd / leaderwd;
- lr = rule_wd % leaderwd;
+ lq = rule_wd / leader_wd;
+ lr = rule_wd % leader_wd;
+
if (subtype(p) == c_leaders)
cur_h = cur_h + (lr / 2);
else
cur_h = cur_h + ((lr - (lq - 1)* lx) / 2);
}
}
- while (cur_h + leaderwd <= edge)
+
+ while (cur_h + leader_wd <= edge)
{
- cur_v = baseline + shift_amount(leaderbox);
+ cur_v = base_line + shift_amount(leader_box);
+
if (cur_v != dvi_v)
{
- movement(cur_v - dvi_v, 157); /* 157 == down1 */
+ movement(cur_v - dvi_v, down1);
dvi_v = cur_v;
}
- savev = dvi_v;
+
+ save_v = dvi_v;
+
if (cur_h != dvi_h)
{
- movement(cur_h - dvi_h, 143); /* 143 == right1 */
+ movement(cur_h - dvi_h, right1);
dvi_h = cur_h;
}
- saveh = dvi_h;
- temp_ptr = leaderbox;
- outerdoingleaders = doing_leaders;
+
+ save_h = dvi_h;
+ temp_ptr = leader_box;
+ outer_doing_leaders = doing_leaders;
doing_leaders = true;
- if (type(leaderbox) == vlist_node)
+
+ if (type(leader_box) == vlist_node)
vlist_out();
else
hlist_out();
- doing_leaders = outerdoingleaders;
- dvi_v = savev;
- dvi_h = saveh;
- cur_v = baseline;
- cur_h = saveh + leaderwd + lx;
+
+ doing_leaders = outer_doing_leaders;
+ dvi_v = save_v;
+ dvi_h = save_h;
+ cur_v = base_line;
+ cur_h = save_h + leader_wd + lx;
}
+
cur_h = edge - 10;
goto lab15;
}
}
+
goto lab13;
}
break;
+
case kern_node:
case math_node:
cur_h = cur_h + width(p);
break;
+
case ligature_node:
{
- mem[lig_trick]= mem[p + 1];
- mem[lig_trick].hh.v.RH = mem[p].hh.v.RH;
+ mem[lig_trick] = mem[lig_char(p)];
+ link(lig_trick) = link(p);
p = lig_trick;
goto lab21;
}
break;
+
default:
break;
}
+
goto lab15;
lab14:
if ((rule_ht == -1073741824L)) /* - 2^30 */
- rule_ht = height(thisbox);
+ rule_ht = height(this_box);
+
if ((rule_dp == -1073741824L)) /* - 2^30 */
- rule_dp = depth(thisbox);
+ rule_dp = depth(this_box);
+
rule_ht = rule_ht + rule_dp;
- if ((rule_ht > 0)&&(rule_wd > 0))
+
+ if ((rule_ht > 0) && (rule_wd > 0))
{
if (cur_h != dvi_h)
{
- movement(cur_h - dvi_h, 143); /* 143 == right1 */
+ movement(cur_h - dvi_h, right1);
dvi_h = cur_h;
}
- cur_v = baseline + rule_dp;
+
+ cur_v = base_line + rule_dp;
+
if (cur_v != dvi_v)
{
- movement(cur_v - dvi_v, 157); /* 157 == down1 */
+ movement(cur_v - dvi_v, down1);
dvi_v = cur_v;
}
- dvi_out(132);
+
+ dvi_out(set_rule);
dvi_four(rule_ht);
dvi_four(rule_wd);
- cur_v = baseline;
+
+ cur_v = base_line;
dvi_h = dvi_h + rule_wd;
}
lab13:
lab15:
p = link(p);
}
- prune_movements(saveloc);
+
+ prune_movements(save_loc);
+
if (cur_s > 0)
- dvi_pop(saveloc);
+ dvi_pop(save_loc);
+
decr(cur_s);
}
/* following needs access to dvi_buf=zdvibuf see coerce.h */
/* sec 0629 */
void vlist_out (void)
{
- scaled leftedge;
- scaled topedge;
- scaled saveh, savev;
- halfword thisbox;
-/* glue_ord gorder; */
- int gorder; /* 95/Jan/7 */
-/* char gsign; */
- int gsign; /* 95/Jan/7 */
+ scaled left_edge;
+ scaled top_edge;
+ scaled save_h, save_v;
+ halfword this_box;
+/* glue_ord g_order; */
+ int g_order; /* 95/Jan/7 */
+/* char g_sign; */
+ int g_sign; /* 95/Jan/7 */
halfword p;
- integer saveloc;
- halfword leaderbox;
- scaled leaderht;
+ integer save_loc;
+ halfword leader_box;
+ scaled leader_ht;
scaled lx;
- bool outerdoingleaders;
+ bool outer_doing_leaders;
scaled edge;
- real gluetemp;
+ real glue_temp;
real cur_glue;
scaled cur_g;
cur_g = 0;
cur_glue = 0.0;
- thisbox = temp_ptr;
- gorder = glue_order(thisbox);
- gsign = glue_sign(thisbox);
- p = list_ptr(thisbox);
+ this_box = temp_ptr;
+ g_order = glue_order(this_box);
+ g_sign = glue_sign(this_box);
+ p = list_ptr(this_box);
incr(cur_s);
+
if (cur_s > 0)
dvi_out(141);
+
if (cur_s > max_push)
max_push = cur_s;
- saveloc = dvi_offset + dvi_ptr;
- leftedge = cur_h;
- cur_v = cur_v - height(thisbox);
- topedge = cur_v;
+
+ save_loc = dvi_offset + dvi_ptr;
+ left_edge = cur_h;
+ cur_v = cur_v - height(this_box);
+ top_edge = cur_v;
while (p != 0)
- { /* while p<>null do l.12494 OK */
+ {
if ((p >= hi_mem_min))
{
confusion("vlistout");
}
else
{
- switch (mem[p].hh.b0)
+ switch (type(p))
{
case hlist_node:
case vlist_node:
- if (mem[p + 5].hh.v.RH == 0)
+ if (list_ptr(p) == 0)
cur_v = cur_v + height(p) + depth(p);
else
{
cur_v = cur_v + height(p);
+
if (cur_v != dvi_v)
{
- movement(cur_v - dvi_v, 157); /* 157 == down1 */
+ movement(cur_v - dvi_v, down1);
dvi_v = cur_v;
}
- saveh = dvi_h;
- savev = dvi_v;
- cur_h = leftedge + shift_amount(p);
+
+ save_h = dvi_h;
+ save_v = dvi_v;
+ cur_h = left_edge + shift_amount(p);
temp_ptr = p;
+
if (type(p) == vlist_node)
vlist_out();
else
hlist_out();
- dvi_h = saveh;
- dvi_v = savev;
- cur_v = savev + depth(p);
- cur_h = leftedge;
+
+ dvi_h = save_h;
+ dvi_v = save_v;
+ cur_v = save_v + depth(p);
+ cur_h = left_edge;
}
break;
+
case rule_node:
{
rule_ht = height(p);
goto lab14;
}
break;
+
case whatsit_node:
out_what(p);
break;
+
case glue_node:
{
g = glue_ptr(p);
rule_ht = width(g) - cur_g;
- if (gsign != normal)
+
+ if (g_sign != normal)
{
- if (gsign == stretching)
+ if (g_sign == stretching)
{
- if (stretch_order(g) == gorder)
+ if (stretch_order(g) == g_order)
{
- //gluetemp = glue_set(thisbox) * mem[g + 2].cint;
cur_glue = cur_glue + stretch(g);
- gluetemp = glue_set(thisbox) * cur_glue;
- if (gluetemp > 1000000000.0)
- gluetemp = 1000000000.0;
- else if (gluetemp < -1000000000.0)
- gluetemp = -1000000000.0;
- //rule_ht = rule_ht + round(gluetemp);
- cur_g = round(gluetemp);
+ glue_temp = glue_set(this_box) * cur_glue;
+
+ if (glue_temp > 1000000000.0)
+ glue_temp = 1000000000.0;
+ else if (glue_temp < -1000000000.0)
+ glue_temp = -1000000000.0;
+
+ cur_g = round(glue_temp);
}
}
- else if (mem[g].hh.b1 == gorder) /* BUG FIX !!! */
+ else if (shrink_order(g) == g_order) /* BUG FIX !!! */
{
- //gluetemp = glue_set(thisbox) * mem[g + 3].cint;
cur_glue = cur_glue - shrink(g);
- gluetemp = glue_set(thisbox) * cur_glue;
- if (gluetemp > 1000000000.0)
- gluetemp = 1000000000.0;
- else if (gluetemp < -1000000000.0)
- gluetemp = -1000000000.0;
- //rule_ht = rule_ht - round(gluetemp);
- cur_g = round(gluetemp);
+ glue_temp = glue_set(this_box) * cur_glue;
+
+ if (glue_temp > 1000000000.0)
+ glue_temp = 1000000000.0;
+ else if (glue_temp < -1000000000.0)
+ glue_temp = -1000000000.0;
+
+ cur_g = round(glue_temp);
}
}
+
rule_ht = rule_ht + cur_g;
+
if (subtype(p) >= a_leaders)
{
- leaderbox = leader_ptr(p);
- if (type(leaderbox) == rule_node)
+ leader_box = leader_ptr(p);
+
+ if (type(leader_box) == rule_node)
{
- rule_wd = width(leaderbox);
+ rule_wd = width(leader_box);
rule_dp = 0;
goto lab14;
}
- leaderht = height(leaderbox) + depth(leaderbox);
- if ((leaderht > 0) && (rule_ht > 0))
+
+ leader_ht = height(leader_box) + depth(leader_box);
+
+ if ((leader_ht > 0) && (rule_ht > 0))
{
rule_ht = rule_ht + 10;
edge = cur_v + rule_ht;
lx = 0;
+
if (subtype(p) == a_leaders)
{
- savev = cur_v;
- cur_v = topedge + leaderht * ((cur_v - topedge) / leaderht);
- if (cur_v < savev)
- cur_v = cur_v + leaderht;
+ save_v = cur_v;
+ cur_v = top_edge + leader_ht * ((cur_v - top_edge) / leader_ht);
+
+ if (cur_v < save_v)
+ cur_v = cur_v + leader_ht;
}
else
{
- lq = rule_ht / leaderht;
- lr = rule_ht % leaderht;
+ lq = rule_ht / leader_ht;
+ lr = rule_ht % leader_ht;
+
if (subtype(p) == c_leaders)
cur_v = cur_v + (lr / 2);
else
cur_v = cur_v + ((lr - (lq - 1) * lx) / 2);
}
}
- while (cur_v + leaderht <= edge)
+
+ while (cur_v + leader_ht <= edge)
{
- cur_h = leftedge + shift_amount(leaderbox);
+ cur_h = left_edge + shift_amount(leader_box);
+
if (cur_h != dvi_h)
{
- movement(cur_h - dvi_h, 143); /* 143 == right1 */
+ movement(cur_h - dvi_h, right1);
dvi_h = cur_h;
}
- saveh = dvi_h;
- cur_v = cur_v + height(leaderbox);
+
+ save_h = dvi_h;
+ cur_v = cur_v + height(leader_box);
+
if (cur_v != dvi_v)
{
- movement(cur_v - dvi_v, 157); /* 157 == down1 */
+ movement(cur_v - dvi_v, down1);
dvi_v = cur_v;
}
- savev = dvi_v;
- temp_ptr = leaderbox;
- outerdoingleaders = doing_leaders;
+
+ save_v = dvi_v;
+ temp_ptr = leader_box;
+ outer_doing_leaders = doing_leaders;
doing_leaders = true;
- if (type(leaderbox) == vlist_node)
+
+ if (type(leader_box) == vlist_node)
vlist_out();
else
hlist_out();
- doing_leaders = outerdoingleaders;
- dvi_v = savev;
- dvi_h = saveh;
- cur_h = leftedge;
- cur_v = savev - height(leaderbox) + leaderht + lx;
+
+ doing_leaders = outer_doing_leaders;
+ dvi_v = save_v;
+ dvi_h = save_h;
+ cur_h = left_edge;
+ cur_v = save_v - height(leader_box) + leader_ht + lx;
}
+
cur_v = edge - 10;
goto lab15;
}
}
+
goto lab13;
}
break;
+
case kern_node:
cur_v = cur_v + width(p);
break;
+
default:
break;
}
goto lab15;
lab14:
if ((rule_wd == -1073741824L)) /* -2^30 */
- rule_wd = width(thisbox);
+ rule_wd = width(this_box);
+
rule_ht = rule_ht + rule_dp;
cur_v = cur_v + rule_ht;
+
if ((rule_ht > 0) && (rule_wd > 0))
{
if (cur_h != dvi_h)
{
- movement(cur_h - dvi_h, 143); /* 143 == right1 */
+ movement(cur_h - dvi_h, right1);
dvi_h = cur_h;
}
+
if (cur_v != dvi_v)
{
- movement(cur_v - dvi_v, 157); /* 157 == down1 */
+ movement(cur_v - dvi_v, down1);
dvi_v = cur_v;
}
- dvi_out(137);
+
+ dvi_out(put_rule);
dvi_four(rule_ht);
dvi_four(rule_wd);
}
lab15:
p = link(p);
}
- prune_movements(saveloc);
+ prune_movements(save_loc);
+
if (cur_s > 0)
- dvi_pop(saveloc);
+ dvi_pop(save_loc);
+
decr(cur_s);
}
/****************HPDF******************/
/* sec 0638 */
void ship_out_(halfword p)
{
- integer pageloc;
+ integer page_loc;
char j, k;
pool_pointer s;
char old_setting;
print_ln();
else if ((term_offset > 0) || (file_offset > 0))
print_char(' ');
+
print_char('[');
j = 9;
+
while((count(j) == 0) && (j > 0))
decr(j);
+
for (k = 0; k <= j; k++)
{
print_int(count(k));
+
if (k < j)
print_char('.');
}
+
#ifndef _WINDOWS
fflush(stdout);
#endif
+
if (tracing_output > 0)
{
print_char(']');
show_box(p);
end_diagnostic(true);
}
- if ((height(p) > 1073741823L) || /* 2^30 - 1 */
- (depth(p) > 1073741823L) ||
- (height(p) + depth(p) + v_offset > 1073741823L) ||
- (width(p) + h_offset > 1073741823L))
+
+ if ((height(p) > max_dimen) || (depth(p) > max_dimen) ||
+ (height(p) + depth(p) + v_offset > max_dimen) ||
+ (width(p) + h_offset > max_dimen))
{
print_err("Huge page cannot be shipped out");
help2("The page just created is more than 18 feet tall or",
"more than 18 feet wide, so I suspect something went wrong.");
error();
+
if (tracing_output <= 0)
{
begin_diagnostic();
}
goto lab30;
}
+
if (height(p) + depth(p) + v_offset > max_v)
max_v = height(p) + depth(p) + v_offset;
+
if (width(p) + h_offset > max_h)
max_h = height(p) + h_offset;
+
dvi_h = 0;
dvi_v = 0;
cur_h = h_offset;
- dvi_f = 0;
+ dvi_f = null_font;
if (output_file_name == 0)
{
if (total_pages == 0)
{
- dvi_out(247);
- dvi_out(2);
-/********BINDING WITH LIBHARU*********/
-/*
- yandy_pdf = HPDF_New(error_handler, NULL);
- yandy_page = HPDF_AddPage(yandy_pdf);
- HPDF_SetInfoAttr(yandy_pdf, HPDF_INFO_PRODUCER, "Y&Y TeX with ApTeX");
- HPDF_SetCompressionMode (yandy_pdf, HPDF_COMP_ALL);
- HPDF_Page_SetSize (yandy_page, HPDF_PAGE_SIZE_A5, HPDF_PAGE_PORTRAIT);
- yandy_font = HPDF_GetFont (yandy_pdf, "Times-Roman", NULL);
- HPDF_Page_BeginText (yandy_page);
- HPDF_Page_SetFontAndSize (yandy_page, yandy_font, 16);
- HPDF_Page_TextOut (yandy_page, 60, HPDF_Page_GetHeight (yandy_page)-90, "This is the \xAErst page.");
- HPDF_Page_TextOut (yandy_page, 60, HPDF_Page_GetHeight (yandy_page)-180, "Wait for ...");
- HPDF_Page_EndText (yandy_page);
- HPDF_SaveToFile (yandy_pdf, "NOTICE.pdf");
- HPDF_Free(yandy_pdf);
- */
-/********BINDING WITH LIBHARU*********/
+ dvi_out(pre);
+ dvi_out(id_byte);
dvi_four(25400000L); /* magic DVI scale factor */
dvi_four(473628672L); /* 7227 * 65536 */
prepare_mag();
dvi_out(str_pool[s]);
pool_ptr = str_start[str_ptr];
- } // end of if total_pages == 0
+ }
+
+ page_loc = dvi_offset + dvi_ptr;
+ dvi_out(bop);
- pageloc = dvi_offset + dvi_ptr;
- dvi_out(139);
for (k = 0; k <= 9; k++)
dvi_four(count(k));
+
dvi_four(last_bop);
- last_bop = pageloc;
+ last_bop = page_loc;
cur_v = height(p) + v_offset;
temp_ptr = p;
+
if (type(p) == vlist_node)
vlist_out();
else
hlist_out();
- dvi_out(140);
+
+ dvi_out(eop);
incr(total_pages);
cur_s = -1;
lab30:;
if (tracing_output <= 0)
print_char(']');
+
dead_cycles = 0;
+
#ifndef _WINDOWS
fflush(stdout);
#endif
print_char(';');
}
#endif /* STAT */
+
flush_node_list(p);
+
#ifdef STAT
if (tracing_stats > 1)
{
#endif /* STAT */
}
/* sec 0645 */
-void scan_spec_(group_code c, bool threecodes)
+void scan_spec_(group_code c, bool three_codes)
{
integer s;
- char speccode;
+ char spec_code;
+
+ if (three_codes)
+ s = saved(0);
- if (threecodes)
- s = save_stack[save_ptr + 0].cint;
if (scan_keyword("to"))
- speccode = 0;
+ spec_code = exactly;
else if (scan_keyword("spread"))
- speccode = 1;
+ spec_code = additional;
else
{
- speccode = 1;
+ spec_code = additional;
cur_val = 0;
goto lab40;
}
+
scan_dimen(false, false, false);
lab40:
- if (threecodes)
+ if (three_codes)
{
- save_stack[save_ptr + 0].cint = s; /* s may be used without ... */
+ saved(0) = s;
incr(save_ptr);
}
- save_stack[save_ptr + 0].cint = speccode;
- save_stack[save_ptr + 1].cint = cur_val;
+
+ saved(0) = spec_code;
+ saved(1) = cur_val;
save_ptr = save_ptr + 2;
new_save_level(c);
scan_left_brace();
/* sec 0649 */
halfword hpack_(halfword p, scaled w, small_number m)
{
- register halfword Result;
halfword r;
halfword q;
scaled h, d, x;
total_shrink[fill] = 0;
total_stretch[filll] = 0;
total_shrink[filll] = 0;
+
while (p != 0)
- { /* while p<>null do l.12862 */
+ {
lab21:
while ((p >= hi_mem_min))
{
f = font(p);
- i = font_info[char_base[f] + mem[p].hh.b1].qqqq;
- hd = i.b1;
- x = x + font_info[width_base[f] + i.b0].cint;
- s = font_info[height_base[f] + (hd) / 16].cint;
+ i = char_info(f, character(p));
+ hd = height_depth(i);
+ x = x + char_width(f, i);
+ s = char_height(f, hd);
+
if (s > h)
h = s;
- s = font_info[depth_base[f] + (hd) % 16].cint;
+
+ s = char_depth(f, hd);
+
if (s > d)
d = s;
+
p = link(p);
}
- if (p != 0) /* if p<>null then l.12886 */
+
+ if (p != 0)
{
- switch (mem[p].hh.b0)
+ switch (type(p))
{
case hlist_node:
case vlist_node:
case unset_node:
{
x = x + width(p);
+
if (type(p) >= rule_node)
s = 0;
else
s = shift_amount(p);
+
if (height(p) - s > h)
h = height(p) - s;
+
if (depth(p) + s > d)
d = depth(p) + s;
}
break;
+
case ins_node:
case mark_node:
case adjust_node:
{
while (link(q) != p)
q = link(q);
+
if (type(p) == adjust_node)
{
link(adjust_tail) = adjust_ptr(p);
+
while (link(adjust_tail)!= 0)
adjust_tail = link(adjust_tail);
+
p = link(p);
free_node(link(q), small_node_size);
}
adjust_tail = p;
p = link(p);
}
+
link(q) = p;
p = q;
}
break;
+
case whatsit_node:
break;
case glue_node:
g = glue_ptr(p);
x = x + width(g);
o = stretch_order(g);
- total_stretch[o]= total_stretch[o] + stretch(g);
+ total_stretch[o] = total_stretch[o] + stretch(g);
o = shrink_order(g);
- total_shrink[o]= total_shrink[o] + shrink(g);
+ total_shrink[o] = total_shrink[o] + shrink(g);
+
if (subtype(p) >= a_leaders)
{
g = leader_ptr(p);
+
if (height(g) > h)
h = height(g);
+
if (depth(g) > d)
d = depth(g);
}
}
break;
+
case kern_node:
case math_node:
x = x + width(p);
break;
+
case ligature_node:
{
mem[lig_trick] = mem[lig_char(p)];
goto lab21;
}
break;
+
default:
break;
}
p = link(p);
}
}
+
if (adjust_tail != 0)
link(adjust_tail) = 0;
+
height(r) = h;
depth(r) = d;
- if (m == 1)
+
+ if (m == additional)
w = x + w;
+
width(r) = w;
x = w - x;
+
if (x == 0)
{
glue_sign(r) = normal;
o = fil;
else
o = normal;
+
glue_order(r) = o;
glue_sign(r) = stretching;
- if (total_stretch[o]!= 0)
+
+ if (total_stretch[o] != 0)
glue_set(r) = x / ((double) total_stretch[o]);
else
{
glue_sign(r) = normal;
glue_set(r) = 0.0;
}
+
if (o == normal)
if (list_ptr(r) != 0)
{
- last_badness = badness(x, total_stretch[0]);
+ last_badness = badness(x, total_stretch[normal]);
+
if (last_badness > hbadness)
{
print_ln();
+
if (last_badness > 100)
print_nl("Underfull");
else
print_nl("Loose");
+
print_string(" \\hbox (badness ");
print_int(last_badness);
+
if (last_badness > 100) /* Y&Y TeX */
underfull_hbox++; /* 1996/Feb/9 */
+
goto lab50;
}
}
o = fil;
else
o = normal;
+
glue_order(r) = o;
glue_sign(r) = shrinking;
+
if (total_shrink[o] != 0)
glue_set(r) =(- (integer) x) / ((double) total_shrink[o]);
else
glue_sign(r) = normal;
glue_set(r) = 0.0;
}
+
if ((total_shrink[o] < - (integer) x) && (o == 0) && (list_ptr(r) != 0))
{
last_badness = 1000000L;
glue_set(r) = 1.0;
- if ((- (integer) x - total_shrink[0] > hfuzz) || (hbadness < 100))
+
+ if ((- (integer) x - total_shrink[normal] > hfuzz) || (hbadness < 100))
{
if ((overfull_rule > 0) && (- (integer) x - total_shrink[0] > hfuzz))
{
while(link(q) != 0)
q = link(q);
+
link(q) = new_rule();
width(link(q)) = overfull_rule;
}
+
print_ln();
print_nl("Overfull \\hbox (");
- print_scaled(- (integer) x - total_shrink[0]);
+ print_scaled(- (integer) x - total_shrink[normal]);
print_string("pt too wide");
+
overfull_hbox++; /* 1996/Feb/9 */
+
goto lab50;
}
}
if (list_ptr(r) != 0)
{
last_badness = badness(- (integer) x, total_shrink[normal]);
+
if (last_badness > hbadness)
{
print_ln();
print_string(") in paragraph at lines ");
else
print_string(") in alignment at lines ");
+
print_int(abs(pack_begin_line));
print_string("--");
}
else
print_string(") detected at line ");
+
print_int(line);
}
+
print_ln();
- font_in_short_display = 0;
+ font_in_short_display = null_font;
short_display(list_ptr(r));
print_ln();
begin_diagnostic();
show_box(r);
end_diagnostic(true);
lab10:
- Result = r;
- return Result;
+ return r;
}
/* sec 0668 */
halfword vpackage_(halfword p, scaled h, small_number m, scaled l)
{
- register halfword Result;
halfword r;
scaled w, d, x;
scaled s;
last_badness = 0;
r = get_node(box_node_size);
type(r) = vlist_node;
- subtype(r) = 0;
+ subtype(r) = min_quarterword;
shift_amount(r) = 0;
list_ptr(r) = p;
w = 0;
confusion("vpack");
return 0; // abort_flag set
}
- else switch (mem[p].hh.b0)
+ else switch (type(p))
{
case hlist_node:
case vlist_node:
{
x = x + d + height(p);
d = depth(p);
+
if (type(p) >= rule_node)
s = 0;
else
s = shift_amount(p);
+
if (width(p) + s > w)
w = width(p) + s;
}
break;
+
case whatsit_node:
break;
+
case glue_node:
{
x = x + d;
if (subtype(p) >= a_leaders)
{
g = leader_ptr(p);
+
if (width(g) > w)
w = width(g);
}
}
break;
+
case kern_node:
{
x = x + d + width(p);
d = 0;
}
break;
+
default:
break;
}
p = link(p);
}
+
width(r) = w;
if (d > l)
else
depth(r) = d;
- if (m == 1)
+ if (m == additional)
h = x + h;
+
height(r) = h;
x = h - x;
+
if (x == 0)
{
glue_sign(r) = normal;
o = fil;
else
o = normal;
+
glue_order(r) = o;
glue_sign(r) = stretching;
if (list_ptr(r) != 0)
{
last_badness = badness(x, total_stretch[normal]);
+
if (last_badness > vbadness)
{
print_ln();
+
if (last_badness > 100)
print_nl("Underfull");
else
print_nl("Loose");
+
print_string(" \\vbox (badness ");
print_int(last_badness);
+
if (last_badness > 100)
underfull_vbox++; /* 1996/Feb/9 */
+
goto lab50;
}
}
o = fil;
else
o = normal;
+
glue_order(r) = o;
glue_sign(r) = shrinking;
- if (total_shrink[o]!= 0)
+
+ if (total_shrink[o] != 0)
glue_set(r) =(- (integer) x)/ ((double) total_shrink[o]);
else
{
{
last_badness = 1000000L;
glue_set(r) = 1.0;
+
if ((- (integer) x - total_shrink[0] > vfuzz) || (vbadness < 100))
{
print_ln();
print_nl("Overfull \\vbox (");
print_scaled(- (integer) x - total_shrink[0]);
print_string("pt too high");
+
overfull_vbox++; /* 1996/Feb/9 */
+
goto lab50;
}
}
lab50:
if (output_active)
print_string(") has occurred while \\output is active");
- else {
+ else
+ {
if (pack_begin_line != 0)
{
print_string(") in alignment at lines ");
}
else
print_string(") detected at line ");
+
print_int(line);
print_ln();
}
+
begin_diagnostic();
show_box(r);
end_diagnostic(true);
lab10:
- Result = r;
- return Result;
+ return r;
}
/* sec 0679 */
void append_to_vlist_(halfword b)
if (cur_list.aux_field.cint > ignore_depth)
{
- d = width(baseline_skip) - cur_list.aux_field.cint - height(b);
+ d = width(baseline_skip) - prev_depth - height(b);
if (d < line_skip_limit)
p = new_param_glue(line_skip_code);
link(tail) = p;
tail = p;
}
+
link(tail) = b;
tail = b;
- cur_list.aux_field.cint = depth(b);
+ prev_depth = depth(b);
}
/* sec 0686 */
halfword new_noad (void)
{
halfword p;
+
p = get_node(noad_size);
type(p) = ord_noad;
subtype(p) = normal;
mem[nucleus(p)].hh = empty_field;
mem[subscr(p)].hh = empty_field;
mem[supscr(p)].hh = empty_field;
+
return p;
}
/* sec 0688 */
halfword new_style_(small_number s)
{
halfword p;
+
p = get_node(style_node_size);
type(p) = style_node;
subtype(p) = s;
width(p) = 0;
depth(p) = 0;
+
return p;
}
/* sec 0689 */
halfword new_choice (void)
{
halfword p;
+
p = get_node(style_node_size);
type(p) = choice_node;
subtype(p) = 0;
text_mlist(p) = 0;
script_mlist(p) = 0;
script_script_mlist(p) = 0;
+
return p;
}
/* sec 0693 */
halfword fraction_rule_(scaled t)
{
halfword p;
+
p = new_rule();
height(p) = t;
depth(p) = 0;
+
return p;
}
+/* sec 0705 */
halfword overbar_(halfword b, scaled k, scaled t)
{
- register halfword Result;
halfword p, q;
+
p = new_kern(k);
- mem[p].hh.v.RH = b;
+ link(p) = b;
q = fraction_rule(t);
- mem[q].hh.v.RH = p;
+ link(q) = p;
p = new_kern(t);
- mem[p].hh.v.RH = q;
- Result = vpackage(p, 0, 1, 1073741823L); /* 2^30 - 1 */
- return Result;
+ link(p) = q;
+ return vpackage(p, 0, 1, 1073741823L); /* 2^30 - 1 */
}
+/* sec 0709 */
halfword char_box_(internal_font_number f, quarterword c)
{
- register halfword Result;
ffourquarters q;
eight_bits hd;
halfword b, p;
- q = font_info[char_base[f] + c].qqqq;
- hd = q.b1;
+
+ q = char_info(f, c);
+ hd = height_depth(q);
b = new_null_box();
- mem[b + 1].cint = font_info[width_base[f] + q.b0].cint + font_info[italic_base[f] + (q.b2) / 4].cint;
- mem[b + 3].cint = font_info[height_base[f] + (hd) / 16].cint;
- mem[b + 2].cint = font_info[depth_base[f] + (hd) % 16].cint;
-/* long to unsigned short ... */
+ width(b) = char_width(f, q) + char_italic(f, q);
+ height(b) = char_height(f, hd);
+ depth(b) = char_depth(f, hd);
p = get_avail();
- mem[p].hh.b1 = c;
- mem[p].hh.b0 = f;
- mem[b + 5].hh.v.RH = p;
- Result = b;
- return Result;
+ character(p) = c;
+ font(p) = f;
+ list_ptr(b) = p;
+
+ return b;
}
+/* sec 0711 */
void stack_into_box_(halfword b, internal_font_number f, quarterword c)
{
halfword p;
+
p = char_box(f, c);
- mem[p].hh.v.RH = mem[b + 5].hh.v.RH;
- mem[b + 5].hh.v.RH = p;
- mem[b + 3].cint = mem[p + 3].cint;
-}
+ link(p) = list_ptr(b);
+ list_ptr(b) = p;
+ height(b) = height(p);
+}
+/* sec 0712 */
scaled height_plus_depth_(internal_font_number f, fquarterword c)
{
- register scaled Result;
ffourquarters q;
eight_bits hd;
- q = font_info[char_base[f]+ c].qqqq;
- hd = q.b1;
- Result = font_info[height_base[f] + (hd) / 16].cint + font_info[depth_base[f] + (hd) % 16].cint;
- return Result;
+
+ q = char_info(f, c);
+ hd = height_depth(q);
+ return char_height(f, hd) + char_depth(f, hd);
}
+/* sec 0706 */
halfword var_delimiter_(halfword d, small_number s, scaled v)
{
register halfword Result;
eight_bits hd;
/* small_number z; */
int z; /* 95/Jan/7 */
-/* bool largeattempt; */
- int largeattempt; /* 95/Jan/7 */
- f = 0;
+/* bool large_attempt; */
+ int large_attempt; /* 95/Jan/7 */
+
+ f = null_font;
w = 0;
- largeattempt = false;
- z = mem[d].qqqq.b0;
- x = mem[d].qqqq.b1;
+ large_attempt = false;
+ z = small_fam(d);
+ x = small_char(d);
+
while (true)
{
if ((z != 0) || (x != 0))
{
z = z + s + 16;
+
do
- {
- z = z - 16;
- g = eqtb[(hash_size + 1835) + z].hh.v.RH;
- if (g != 0) {
- y = x;
- if ((y >= font_bc[g]) && (y <= font_ec[g]))
+ {
+ z = z - 16;
+ g = fam_fnt(z);
+
+ if (g != null_font)
{
-lab22:
- q = font_info[char_base[g]+ y].qqqq;
- if ((q.b0 > 0))
+ y = x;
+
+ if ((y >= font_bc[g]) && (y <= font_ec[g]))
{
- if (((q.b2) % 4) == 3)
+lab22:
+ q = char_info(g, y);
+
+ if ((q.b0 > 0))
{
- f = g;
- c = y;
- goto lab40;
- }
- hd = q.b1;
- u = font_info[height_base[g] + (hd) / 16].cint + font_info[depth_base[g] + (hd) % 16].cint;
- if (u > w) {
- f = g;
- c = y;
- w = u;
- if (u >= v)
+ if (char_tag(q) == ext_tag)
+ {
+ f = g;
+ c = y;
goto lab40;
- }
- if (((q.b2)% 4)== 2) {
- y = q.b3;
- goto lab22;
+ }
+
+ hd = height_depth(q);
+ u = char_height(g, hd) + char_depth(g, hd);
+
+ if (u > w)
+ {
+ f = g;
+ c = y;
+ w = u;
+
+ if (u >= v)
+ goto lab40;
+ }
+
+ if (char_tag(q) == list_tag)
+ {
+ y = rem_byte(q);
+ goto lab22;
+ }
}
}
}
}
- } while (!(z < 16));
- }
- if (largeattempt)
+ while (!(z < 16));
+ }
+
+ if (large_attempt)
goto lab40;
- largeattempt = true;
- z = mem[d].qqqq.b2;
- x = mem[d].qqqq.b3;
+
+ large_attempt = true;
+ z = large_fam(d);
+ x = large_char(d);
}
lab40:
- if (f != 0)
- if (((q.b2) % 4)== 3) /* q may be used without ... */
+ if (f != null_font)
+ if (char_tag(q) == ext_tag)
{
- b = new_null_box();
- mem[b].hh.b0 = 1;
- r = font_info[exten_base[f]+ q.b3].qqqq;
- c = r.b3;
+ b = new_null_box();
+ type(b) = vlist_node;
+ r = font_info[exten_base[f] + rem_byte(q)].qqqq;
+ c = ext_rep(r);
u = height_plus_depth(f, c);
w = 0;
- q = font_info[char_base[f]+ c].qqqq;
- mem[b + 1].cint = font_info[width_base[f]+ q.b0].cint + font_info[italic_base[f]+(q.b2) / 4].cint;
- c = r.b2;
- if (c != 0)
+ q = char_info(f, c);
+ width(b) = char_width(f, q) + char_italic(f, q);
+ c = ext_bot(r);
+
+ if (c != min_quarterword)
w = w + height_plus_depth(f, c);
- c = r.b1;
- if (c != 0)
+
+ c = ext_mid(r);
+
+ if (c != min_quarterword)
w = w + height_plus_depth(f, c);
- c = r.b0;
- if (c != 0)
+
+ c = ext_top(r);
+
+ if (c != min_quarterword)
w = w + height_plus_depth(f, c);
+
n = 0;
+
if (u > 0)
- while(w < v) {
+ while(w < v)
+ {
w = w + u;
incr(n);
- if (r.b1 != 0)
+
+ if (ext_mid(r) != min_quarterword)
w = w + u;
}
- c = r.b2;
- if (c != 0)
- stack_into_box(b, f, c);
- c = r.b3;
+
+ c = ext_bot(r);
+
+ if (c != min_quarterword)
+ stack_into_box(b, f, c);
+
+ c = ext_rep(r);
+
+ for (m = 1; m <= n; m++)
+ stack_into_box(b, f, c);
+
+ c = ext_mid(r);
+
+ if (c != min_quarterword)
+ {
+ stack_into_box(b, f, c);
+ c = ext_rep(r);
+
for (m = 1; m <= n; m++)
- {
stack_into_box(b, f, c);
- }
- c = r.b1;
- if (c != 0) {
- stack_into_box(b, f, c);
- c = r.b3;
- for (m = 1; m <= n; m++)
- {
- stack_into_box(b, f, c);
- }
- }
- c = r.b0;
- if (c != 0)
- stack_into_box(b, f, c);
- mem[b + 2].cint = w - mem[b + 3].cint;
- } else b = char_box(f, c);
- else { /* c may be used without ... */
+ }
+
+ c = ext_top(r);
+
+ if (c != 0)
+ stack_into_box(b, f, c);
+
+ depth(b) = w - height(b);
+ }
+ else
+ b = char_box(f, c);
+ else
+ {
b = new_null_box();
- mem[b + 1].cint = null_delimiter_space;
- }
- mem[b + 4].cint = half(mem[b + 3].cint - mem[b + 2].cint) - font_info[22 + param_base[eqtb[(hash_size + 1837) + s].hh.v.RH]].cint;
- Result = b;
- return Result;
+ width(b) = null_delimiter_space;
+ }
+
+ shift_amount(b) = half(height(b) - depth(b)) - axis_height(s);
+
+ return b;
}
-/* rebox_ etc used to follow here in tex4.c */
+/* rebox_ etc used to follow here in tex4.c */
\ No newline at end of file