-#ifdef _WINDOWS
- #define NOCOMM
- #define NOSOUND
- #define NODRIVERS
- #define STRICT
- #pragma warning(disable:4115) // kill rpcasync.h complaint
- #include <windows.h>
- #define MYLIBAPI __declspec(dllexport)
-#endif
+/* Copyright 2014 Clerk Ma
-#include "texwin.h"
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
-#pragma warning(disable:4996)
-#pragma warning(disable:4131) // old style declarator
-#pragma warning(disable:4135) // conversion between different integral types
-#pragma warning(disable:4127) // conditional expression is constant
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
-#include <setjmp.h>
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301 USA. */
#define EXTERN extern
#include "texd.h"
-#pragma warning(disable:4244) /* 96/Jan/10 */
-
/* sec 0581 */
void char_warning_(internal_font_number f, eight_bits c)
{
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))
+ if (char_exists(char_info(f, c)))
{
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;
+
+ char_warning(f, c);
+ return 0;
}
-/* following needs access to dvi_buf=zdvibuf see coerce.h */
/* sec 0598 */
void dvi_swap (void)
{
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 */
/* attempt at speeding up bkph - is compiler smart ? */
/* sec 0600 */
void dvi_four_(integer x)
{
if (x >= 0)
- // dvi_out(x % 16777216L);
- dvi_out((x >> 24));
+ dvi_out(x / 0100000000); // dvi_out((x >> 24));
else
{
- x = x + 1073741824L; /* 2^30 40000000 hex */
- x = x + 1073741824L;
- //dvi_out((x / 16777216L) + 128);
- dvi_out((x >> 24) + 128);
+ x = x + 010000000000;
+ x = x + 010000000000;
+ dvi_out((x / 0100000000) + 128); // dvi_out((x >> 24) + 128);
}
-/* x = x % 16777216L; */ /* % 2^24 */
- x = x & 16777215L;
- //dvi_out(x / 65536L);
- dvi_out((x >> 16));
-/* x = x % 65536L; */ /* % 2^16 */
- x = x & 65535L;
- //dvi_out(x / 256);
- dvi_out((x >> 8));
- //dvi_out(x % 256);
- dvi_out(x & 255);
+
+ x = x % 0100000000; // x = x & 16777215L;
+ dvi_out(x / 0200000); // dvi_out((x >> 16));
+ x = x % 0200000; // x = x & 65535L;
+ dvi_out(x / 0400); // dvi_out((x >> 8));
+ dvi_out(x % 0400); // dvi_out(x & 255);
}
-/* following needs access to dvi_buf=zdvibuf see coerce.h */
/* sec 0601 */
void zdvipop(integer l)
{
else
dvi_out(142);
}
-/* following needs access to dvi_buf=zdvibuf see coerce.h */
/* sec 0602 */
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
-/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
-/* spit out the font checksum now */
+
dvi_out(font_check[f].b0);
dvi_out(font_check[f].b1);
dvi_out(font_check[f].b2);
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 */
/* sec 0607 */
void zmovement(scaled w, eight_bits o)
{
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 */
/* sec 1368 */
-void special_out_(halfword p)
+void special_out_(pointer p)
{
char old_setting;
pool_pointer k;
- 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;
- }
+ synch_h();
+ synch_v();
old_setting = selector;
selector = new_string;
-/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
-/* About output \special{...} make some space in string pool 97/Mar/9 */
+
#ifdef ALLOCATESTRING
if (pool_ptr + 32000 > current_pool_size)
str_pool = realloc_str_pool (increment_pool_size);
-/* We don't bother to check whether this worked - will catch later */
-#endif
-/* Potential problem here if current_pool_size is not much more than pool_ptr! */
-/* 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);
-/* Above is safe, since print/print_char/print_esc will extend string space */
+
+ show_token_list(link(write_tokens(p)), 0, 10000000L);
#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)
{
-/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
-/* str_room(1) - is there space for one more character in string pool ? */
-#ifdef ALLOCATESTRING
- if (pool_ptr + 1 > current_pool_size)
- str_pool = realloc_str_pool (increment_pool_size);
- if (pool_ptr + 1 > current_pool_size)
- { /* in case it failed 94/Jan/24 */
- overflow("pool size", current_pool_size - init_pool_ptr); /* 97/Mar/7 */
- return; // abort_flag set
- }
-#else
-/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
- if (pool_ptr + 1 > pool_size)
- {
- overflow("pool size", pool_size - init_pool_ptr); /* pool size */
- return; // abort_flag set
- }
-#endif
+ dvi_out(xxx1);
+ dvi_out(cur_length);
}
- if (cur_length < 256) /* can use xxx1 ? */
+ else
{
- dvi_out(239);
-/* long to unsigned char ... */
- dvi_out(cur_length);
- } else { /* use xxx4 instead */
- dvi_out(242);
+ dvi_out(xxx4);
dvi_four(cur_length);
}
-#ifdef IGNORED
-/* debugging code for \special{src: ... } 98/Nov/11 */
- {
- 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: ... } */
- show_char('\n');
- s = log_line;
- 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 ? */
- print(cur_input.name_field);
- print_char('(');
- print_int(line); /* line number */
- print_char(')');
- print_char(' ');
- print_char(':');
- }
-#ifndef _WINDOWS
- fflush(stdout);
-#endif
- }
- }
- }
-#endif
for (k = str_start[str_ptr]; k <= pool_ptr - 1; k++)
dvi_out(str_pool[k]);
+
pool_ptr = str_start[str_ptr];
}
-/* noew returns -1 if it fails */
/* sec 1370 */
-void write_out_(halfword p)
+void write_out_(pointer p)
{
char old_setting;
/* integer oldmode; */
/* 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));
}
+
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);
selector = old_setting;
}
/* sec 1373 */
-void out_what_(halfword p)
+void out_what_(pointer p)
{
/* 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(1294, 785); /* 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;
- }
-}
-/* following needs access to dvi_buf=zdvibuf see coerce.h */
+
+ 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;
+ }
+}
/* 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;
+ boolean 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)
+ if (is_char_node(p))
{
- movement(cur_v - dvi_v, 157); /* 157 == down1 */
- dvi_v = cur_v;
- }
- do
- {
- f = font(p);
- c = character(p);
- if (f != dvi_f)
- {
- if (!font_used[f])
+ synch_h();
+ synch_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);
#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);
- if (cur_v != dvi_v)
- {
- movement(cur_v - dvi_v, 157); /* 157 == down1 */
- dvi_v = cur_v;
- }
- savev = dvi_v;
- if (cur_h != dvi_h)
- {
- movement(cur_h - dvi_h, 143); /* 143 == right1 */
- dvi_h = cur_h;
- }
- saveh = dvi_h;
- temp_ptr = leaderbox;
- outerdoingleaders = doing_leaders;
+ cur_v = base_line + shift_amount(leader_box);
+ synch_v();
+ save_v = dvi_v;
+ synch_h();
+ 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 */
- dvi_h = cur_h;
- }
- cur_v = baseline + rule_dp;
- if (cur_v != dvi_v)
- {
- movement(cur_v - dvi_v, 157); /* 157 == down1 */
- dvi_v = cur_v;
- }
- dvi_out(132);
+ synch_h();
+ cur_v = base_line + rule_dp;
+ synch_v();
+ 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;
+ boolean 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 */
- dvi_v = cur_v;
- }
- saveh = dvi_h;
- savev = dvi_v;
- cur_h = leftedge + shift_amount(p);
+ synch_v();
+ 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
{
- lx =(2 * lr + lq + 1) / (2 * lq + 2);
+ lx = (2 * lr + lq + 1) / (2 * lq + 2);
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);
- if (cur_h != dvi_h)
- {
- movement(cur_h - dvi_h, 143); /* 143 == right1 */
- dvi_h = cur_h;
- }
- saveh = dvi_h;
- cur_v = cur_v + height(leaderbox);
- if (cur_v != dvi_v)
- {
- movement(cur_v - dvi_v, 157); /* 157 == down1 */
- dvi_v = cur_v;
- }
- savev = dvi_v;
- temp_ptr = leaderbox;
- outerdoingleaders = doing_leaders;
+ cur_h = left_edge + shift_amount(leader_box);
+ synch_h();
+ save_h = dvi_h;
+ cur_v = cur_v + height(leader_box);
+ synch_v();
+ 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 */
- dvi_h = cur_h;
- }
- if (cur_v != dvi_v)
- {
- movement(cur_v - dvi_v, 157); /* 157 == down1 */
- dvi_v = cur_v;
- }
- dvi_out(137);
+ synch_h();
+ synch_v();
+ dvi_out(put_rule);
dvi_four(rule_ht);
dvi_four(rule_wd);
}
+
goto lab15;
lab13:
cur_v = cur_v + rule_ht;
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******************/
-/*
-void error_handler (HPDF_STATUS error_no, HPDF_STATUS detail_no, void * user_data)
-{
- printf ("ERROR: error_no=%04X, detail_no=%u\n", (HPDF_UINT)error_no, (HPDF_UINT)detail_no);
-}
-*/
-/****************HPDF******************/
/* sec 0638 */
-/* following needs access to dvi_buf=zdvibuf see coerce.h */
-/* sec 0638 */
-void ship_out_(halfword p)
+void dvi_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();
show_box(p);
end_diagnostic(true);
}
+
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;
+ max_h = width(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 (job_name == 0)
open_log_file();
- pack_job_name(788); /* .dvi */
+
+ pack_job_name(".dvi");
+
while(!b_open_out(dvi_file))
{
- prompt_file_name(789, 788); /* file name for output .dvi */
+ prompt_file_name("file name for output", ".dvi");
}
+
output_file_name = b_make_name_string(dvi_file);
}
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();
print_two(tex_time / 60);
print_two(tex_time % 60);
selector = old_setting;
-/* long to unsigned char ... */
dvi_out(cur_length);
+
for (s = str_start[str_ptr]; s <= pool_ptr - 1; s++)
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); // do not need a endpage in haru.
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 */
}
+void ship_out_(halfword p)
+{
+ if (pdf_output_flag)
+ pdf_ship_out(p);
+ else
+ dvi_ship_out_(p);
+}
/* sec 0645 */
-void scan_spec_(group_code c, bool threecodes)
+void scan_spec_(group_code c, boolean 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;
/* glue_ord o; */
int o; /* 95/Jan/7 */
internal_font_number f;
- ffourquarters i;
+ four_quarters i;
eight_bits hd;
+
last_badness = 0;
- r = get_node(7);
- mem[r].hh.b0 = 0;
- mem[r].hh.b1 = 0;
- mem[r + 4].cint = 0;
- q = r + 5;
- mem[q].hh.v.RH = p;
+ r = get_node(box_node_size);
+ type(r) = hlist_node;
+ subtype(r) = 0;
+ shift_amount(r) = 0;
+ q = r + list_offset;
+ link(q) = p;
h = 0;
d = 0;
x = 0;
- total_stretch[0] = 0;
- total_shrink[0] = 0;
- total_stretch[1] = 0;
- total_shrink[1] = 0;
- total_stretch[2] = 0;
- total_shrink[2] = 0;
- total_stretch[3] = 0;
- total_shrink[3] = 0;
- while (p != 0) { /* while p<>null do l.12862 */
+ total_stretch[normal] = 0;
+ total_shrink[normal] = 0;
+ total_stretch[fil] = 0;
+ total_shrink[fil] = 0;
+ total_stretch[fill] = 0;
+ total_shrink[fill] = 0;
+ total_stretch[filll] = 0;
+ total_shrink[filll] = 0;
+
+ while (p != 0)
+ {
lab21:
- while ((p >= hi_mem_min)) {
- f = mem[p].hh.b0;
- 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;
+ while ((p >= hi_mem_min))
+ {
+ f = font(p);
+ 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 = mem[p].hh.v.RH;
+
+ p = link(p);
}
- if (p != 0) /* if p<>null then l.12886 */
+
+ if (p != 0)
{
- switch (mem[p].hh.b0)
+ switch (type(p))
{
- case 0:
- case 1:
- case 2:
- case 13:
- {
- x = x + mem[p + 1].cint;
- if (mem[p].hh.b0 >= 2)
- s = 0;
- else
- s = mem[p + 4].cint;
- if (mem[p + 3].cint - s > h)
- h = mem[p + 3].cint - s;
- if (mem[p + 2].cint + s > d)
- d = mem[p + 2].cint + s;
- }
- break;
- case 3:
- case 4:
- case 5:
-/* if adjust_tail<>null then link(adjust_tail):=null; l.12865 / 12891 */
- if (adjust_tail != 0)
- {
- while (mem[q].hh.v.RH != p)
- q = mem[q].hh.v.RH;
- if (mem[p].hh.b0 == 5) {
- mem[adjust_tail].hh.v.RH = mem[p + 1].cint;
- while (mem[adjust_tail].hh.v.RH != 0)
- adjust_tail = mem[adjust_tail].hh.v.RH;
- p = mem[p].hh.v.RH;
- free_node(mem[q].hh.v.RH, 2);
- } else {
- mem[adjust_tail].hh.v.RH = p;
- adjust_tail = p;
- p = mem[p].hh.v.RH;
+ case hlist_node:
+ case vlist_node:
+ case rule_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;
}
- mem[q].hh.v.RH = p;
- p = q;
- }
- break;
- case 8:
- ;
- break;
- case 10:
- {
- g = mem[p + 1].hh.v.LH;
- x = x + mem[g + 1].cint;
- o = mem[g].hh.b0;
- total_stretch[o]= total_stretch[o]+ mem[g + 2].cint;
- o = mem[g].hh.b1;
- total_shrink[o]= total_shrink[o]+ mem[g + 3].cint;
- if (mem[p].hh.b1 >= 100) {
- g = mem[p + 1].hh.v.RH;
- if (mem[g + 3].cint > h)
- h = mem[g + 3].cint;
- if (mem[g + 2].cint > d)
- d = mem[g + 2].cint;
+ break;
+
+ case ins_node:
+ case mark_node:
+ case adjust_node:
+ if (adjust_tail != 0)
+ {
+ 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);
+ }
+ else
+ {
+ link(adjust_tail) = p;
+ adjust_tail = p;
+ p = link(p);
+ }
+
+ link(q) = p;
+ p = q;
}
- }
- break;
- case 11:
- case 9:
- x = x + mem[p + 1].cint;
- break;
- case 6:
- {
- mem[lig_trick]= mem[p + 1];
- mem[lig_trick].hh.v.RH = mem[p].hh.v.RH;
- p = lig_trick;
- goto lab21;
- }
- break;
- default:
- ;
- break;
+ 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);
+ o = shrink_order(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)];
+ link(lig_trick) = link(p);
+ p = lig_trick;
+ goto lab21;
+ }
+ break;
+
+ default:
+ break;
}
- p = mem[p].hh.v.RH;
+ p = link(p);
}
}
+
if (adjust_tail != 0)
- mem[adjust_tail].hh.v.RH = 0;
- mem[r + 3].cint = h;
- mem[r + 2].cint = d;
- if (m == 1)
+ link(adjust_tail) = 0;
+
+ height(r) = h;
+ depth(r) = d;
+
+ if (m == additional)
w = x + w;
- mem[r + 1].cint = w;
+
+ width(r) = w;
x = w - x;
- if (x == 0) {
- mem[r + 5].hh.b0 = 0;
- mem[r + 5].hh.b1 = 0;
- mem[r + 6].gr = 0.0;
+
+ if (x == 0)
+ {
+ glue_sign(r) = normal;
+ glue_order(r) = normal;
+ glue_set(r) = 0.0;
goto lab10;
- } else if (x > 0) {
- if (total_stretch[3] != 0)
- o = 3;
- else if (total_stretch[2] != 0)
- o = 2;
- else if (total_stretch[1] != 0)
- o = 1;
+ }
+ else if (x > 0)
+ {
+ if (total_stretch[filll] != 0)
+ o = filll;
+ else if (total_stretch[fill] != 0)
+ o = fill;
+ else if (total_stretch[fil] != 0)
+ o = fil;
else
- o = 0;
- mem[r + 5].hh.b1 = o;
- mem[r + 5].hh.b0 = 1;
-/* if total_stretch[o]<>0 then glue_set(r):=... l.12982 */
- if (total_stretch[o]!= 0)
- mem[r + 6].gr = x / ((double) total_stretch[o]);
- else {
- mem[r + 5].hh.b0 = 0;
- mem[r + 6].gr = 0.0;
+ o = normal;
+
+ glue_order(r) = o;
+ glue_sign(r) = stretching;
+
+ 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 then if list_ptr(r)<>null then l.12987 */
- if (o == 0)
- if (mem[r + 5].hh.v.RH != 0)
+
+ if (o == normal)
+ if (list_ptr(r) != 0)
{
- last_badness = badness(x, total_stretch[0]);
- if (last_badness > hbadness) {
+ 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)
+
+ if (last_badness > 100) /* Y&Y TeX */
underfull_hbox++; /* 1996/Feb/9 */
+
goto lab50;
}
}
goto lab10;
- } else {
- if (total_shrink[3] != 0)
- o = 3;
- else if (total_shrink[2] != 0)
- o = 2;
- else if (total_shrink[1] != 0)
- o = 1;
+ }
+ else
+ {
+ if (total_shrink[filll] != 0)
+ o = filll;
+ else if (total_shrink[fill] != 0)
+ o = fill;
+ else if (total_shrink[fil] != 0)
+ o = fil;
else
- o = 0;
- mem[r + 5].hh.b1 = o;
- mem[r + 5].hh.b0 = 2;
+ o = normal;
+
+ glue_order(r) = o;
+ glue_sign(r) = shrinking;
+
if (total_shrink[o] != 0)
- mem[r + 6].gr =(- (integer) x) / ((double) total_shrink[o]);
- else {
- mem[r + 5].hh.b0 = 0;
- mem[r + 6].gr = 0.0;
- }
-/* if (total_shrink[o]<-x)and(o=normal)and(list_ptr(r)<>null) then l.13946 */
- if ((total_shrink[o]< - (integer) x) && (o == 0) && (mem[r + 5].hh.v.RH != 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;
-/* set_glue_ratio_one(glue_set(r)); {use the maximum shrinkage} */
- mem[r + 6].gr = 1.0;
-/* if (-x-total_shrink[normal]>hfuzz)or(hbadness<100) then */
- if ((- (integer) x - total_shrink[0] > hfuzz) ||
- (hbadness < 100)) {
- if ((overfull_rule > 0) &&
- (- (integer) x - total_shrink[0] > hfuzz)) {
- while(mem[q].hh.v.RH != 0)q = mem[q].hh.v.RH;
- mem[q].hh.v.RH = new_rule();
- mem[mem[q].hh.v.RH + 1].cint = overfull_rule;
+ glue_set(r) = 1.0;
+
+ 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_nl("Overfull \\hbox (");
+ print_scaled(- (integer) x - total_shrink[normal]);
print_string("pt too wide");
+
overfull_hbox++; /* 1996/Feb/9 */
+
goto lab50;
}
- } else if (o == 0)
- if (mem[r + 5].hh.v.RH != 0) {
- last_badness = badness(- (integer) x, total_shrink[0]);
- if (last_badness > hbadness) {
+ }
+ else if (o == normal)
+ if (list_ptr(r) != 0)
+ {
+ last_badness = badness(- (integer) x, total_shrink[normal]);
+
+ if (last_badness > hbadness)
+ {
print_ln();
print_nl("Tight \\hbox (badness ");
print_int(last_badness);
goto lab50;
}
}
- goto lab10;
+ goto lab10;
}
lab50:
if (output_active)
print_string(") has occurred while \\output is active");
- else {
- if (pack_begin_line != 0) {
+ else
+ {
+ if (pack_begin_line != 0)
+ {
if (pack_begin_line > 0)
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 ");
+ }
+ else
+ print_string(") detected at line ");
+
print_int(line);
}
+
print_ln();
- font_in_short_display = 0;
- short_display(mem[r + 5].hh.v.RH);
+ 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;
halfword g;
/* glue_ord o; */
int o; /* 95/Jan/7 */
+
last_badness = 0;
- r = get_node(7);
- mem[r].hh.b0 = 1;
- mem[r].hh.b1 = 0;
- mem[r + 4].cint = 0;
- mem[r + 5].hh.v.RH = p;
+ r = get_node(box_node_size);
+ type(r) = vlist_node;
+ subtype(r) = min_quarterword;
+ shift_amount(r) = 0;
+ list_ptr(r) = p;
w = 0;
d = 0;
x = 0;
- total_stretch[0] = 0;
- total_shrink[0] = 0;
- total_stretch[1] = 0;
- total_shrink[1] = 0;
- total_stretch[2] = 0;
- total_shrink[2] = 0;
- total_stretch[3] = 0;
- total_shrink[3] = 0;
- while (p != 0) {
- if ((p >= hi_mem_min)) {
+ total_stretch[normal] = 0;
+ total_shrink[normal] = 0;
+ total_stretch[fil] = 0;
+ total_shrink[fil] = 0;
+ total_stretch[fill] = 0;
+ total_shrink[fill] = 0;
+ total_stretch[filll] = 0;
+ total_shrink[filll] = 0;
+
+ while (p != 0)
+ {
+ if ((p >= hi_mem_min))
+ {
confusion("vpack");
return 0; // abort_flag set
- } else switch (mem[p].hh.b0)
+ }
+ else switch (type(p))
{
- case 0:
- case 1:
- case 2:
- case 13:
- {
- x = x + d + mem[p + 3].cint;
- d = mem[p + 2].cint;
- if (mem[p].hh.b0 >= 2)
- s = 0;
- else s = mem[p + 4].cint;
- if (mem[p + 1].cint + s > w)
- w = mem[p + 1].cint + s;
- }
- break;
- case 8:
- ;
- break;
- case 10:
- {
- x = x + d;
- d = 0;
- g = mem[p + 1].hh.v.LH;
- x = x + mem[g + 1].cint;
- o = mem[g].hh.b0;
- total_stretch[o] = total_stretch[o]+ mem[g + 2].cint;
- o = mem[g].hh.b1;
- total_shrink[o]= total_shrink[o]+ mem[g + 3].cint;
- if (mem[p].hh.b1 >= 100) {
- g = mem[p + 1].hh.v.RH;
- if (mem[g + 1].cint > w)
- w = mem[g + 1].cint;
+ case hlist_node:
+ case vlist_node:
+ case rule_node:
+ case unset_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 11:
- {
- x = x + d + mem[p + 1].cint;
- d = 0;
- }
- break;
+ break;
+
+ case whatsit_node:
+ break;
+
+ case glue_node:
+ {
+ x = x + d;
+ d = 0;
+ g = glue_ptr(p);
+ x = x + width(g);
+ o = stretch_order(g);
+ total_stretch[o] = total_stretch[o] + stretch(g);
+ o = shrink_order(g);
+ total_shrink[o] = total_shrink[o] + shrink(g);
+
+ 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;
+ break;
}
- p = mem[p].hh.v.RH;
+ p = link(p);
}
- mem[r + 1].cint = w;
- if (d > l) {
+
+ width(r) = w;
+
+ if (d > l)
+ {
x = x + d - l;
- mem[r + 2].cint = l;
- } else mem[r + 2].cint = d;
- if (m == 1)
+ depth(r) = l;
+ }
+ else
+ depth(r) = d;
+
+ if (m == additional)
h = x + h;
- mem[r + 3].cint = h;
+
+ height(r) = h;
x = h - x;
- if (x == 0) {
- mem[r + 5].hh.b0 = 0;
- mem[r + 5].hh.b1 = 0;
- mem[r + 6].gr = 0.0;
+
+ if (x == 0)
+ {
+ glue_sign(r) = normal;
+ glue_order(r) = normal;
+ glue_set(r) = 0.0;
goto lab10;
- } else if (x > 0) {
- if (total_stretch[3] != 0)
- o = 3;
- else if (total_stretch[2]!= 0)
- o = 2;
- else if (total_stretch[1]!= 0)
- o = 1;
+ }
+ else if (x > 0)
+ {
+ if (total_stretch[filll] != 0)
+ o = filll;
+ else if (total_stretch[fill] != 0)
+ o = fill;
+ else if (total_stretch[fil] != 0)
+ o = fil;
else
- o = 0;
- mem[r + 5].hh.b1 = o;
- mem[r + 5].hh.b0 = 1;
+ o = normal;
+
+ glue_order(r) = o;
+ glue_sign(r) = stretching;
+
if (total_stretch[o] != 0)
- mem[r + 6].gr = x / ((double) total_stretch[o]);
- else {
- mem[r + 5].hh.b0 = 0;
- mem[r + 6].gr = 0.0;
+ glue_set(r) = x / ((double) total_stretch[o]);
+ else
+ {
+ glue_sign(r) = normal;
+ glue_set(r) = 0.0;
}
- if (o == 0)
- if (mem[r + 5].hh.v.RH != 0) {
- last_badness = badness(x, total_stretch[0]);
- if (last_badness > vbadness) {
+
+ if (o == normal)
+ 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;
}
}
goto lab10;
- } else {
- if (total_shrink[3] != 0)
- o = 3;
- else if (total_shrink[2] != 0)
- o = 2;
- else if (total_shrink[1]!= 0)
- o = 1;
+ }
+ else
+ {
+ if (total_shrink[filll] != 0)
+ o = filll;
+ else if (total_shrink[fill] != 0)
+ o = fill;
+ else if (total_shrink[fil] != 0)
+ o = fil;
else
- o = 0;
- mem[r + 5].hh.b1 = o;
- mem[r + 5].hh.b0 = 2;
- if (total_shrink[o]!= 0)
- mem[r + 6].gr =(- (integer) x)/ ((double) total_shrink[o]);
- else {
- mem[r + 5].hh.b0 = 0;
- mem[r + 6].gr = 0.0;
+ 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]<-x)and(o=normal)and(list_ptr(r)<>null) then l.13046 */
- if ((total_shrink[o] < - (integer) x) && (o == 0) && (mem[r + 5].hh.v.RH != 0)) {
+
+ if ((total_shrink[o] < - (integer) x) && (o == 0) && (list_ptr(r) != 0))
+ {
last_badness = 1000000L;
- mem[r + 6].gr = 1.0;
- if ((- (integer) x - total_shrink[0] > eqtb[(hash_size + 3739)].cint) ||
- (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;
+ 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;
}
}
-/* else if o=normal then if list_ptr(r)<>null then l.13052 */
else if (o == 0)
- if (mem[r + 5].hh.v.RH != 0) {
- last_badness = badness(- (integer) x, total_shrink[0]);
- if (last_badness > vbadness) {
+ if (list_ptr(r) != 0)
+ {
+ last_badness = badness(- (integer) x, total_shrink[normal]);
+ if (last_badness > vbadness)
+ {
print_ln();
print_nl("Tight \\vbox (badness ");
print_int(last_badness);
goto lab50;
}
}
- goto lab10;
+ goto lab10;
}
lab50:
if (output_active)
print_string(") has occurred while \\output is active");
- else {
- if (pack_begin_line != 0) {
+ else
+ {
+ if (pack_begin_line != 0)
+ {
print_string(") in alignment at lines ");
print_int(abs(pack_begin_line));
print_string("--");
- } else print_string(") detected at line ");
+ }
+ 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)
{
scaled d;
halfword p;
- if (cur_list.aux_field.cint > ignore_depth) {
- d = mem[eqtb[(hash_size + 783)].hh.v.RH + 1].cint - cur_list.aux_field.cint - mem[b + 3].cint;
+
+ if (cur_list.aux_field.cint > ignore_depth)
+ {
+ d = width(baseline_skip) - prev_depth - height(b);
+
if (d < line_skip_limit)
- p = new_param_glue(0);
- else {
- p = new_skip_param(1);
- mem[temp_ptr + 1].cint = d;
+ p = new_param_glue(line_skip_code);
+ else
+ {
+ p = new_skip_param(baseline_skip_code);
+ width(temp_ptr) = d;
}
- mem[tail].hh.v.RH = p;
+ link(tail) = p;
tail = p;
}
- mem[tail].hh.v.RH = b;
+
+ link(tail) = b;
tail = b;
- cur_list.aux_field.cint = mem[b + 2].cint;
+ prev_depth = depth(b);
}
-halfword new_noad (void)
+/* sec 0686 */
+halfword new_noad (void)
{
- register halfword Result;
halfword p;
- p = get_node(4);
- mem[p].hh.b0 = 16;
- mem[p].hh.b1 = 0;
- mem[p + 1].hh = empty_field;
- mem[p + 3].hh = empty_field;
- mem[p + 2].hh = empty_field;
- Result = p;
- return Result;
-}
+
+ 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)
{
- register halfword Result;
halfword p;
- p = get_node(3);
- mem[p].hh.b0 = 14;
- mem[p].hh.b1 = s;
- mem[p + 1].cint = 0;
- mem[p + 2].cint = 0;
- Result = p;
- return Result;
+
+ 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)
{
- register halfword Result;
halfword p;
- p = get_node(3);
- mem[p].hh.b0 = 15;
- mem[p].hh.b1 = 0;
- mem[p + 1].hh.v.LH = 0;
- mem[p + 1].hh.v.RH = 0;
- mem[p + 2].hh.v.LH = 0;
- mem[p + 2].hh.v.RH = 0;
- Result = p;
- return Result;
+
+ p = get_node(style_node_size);
+ type(p) = choice_node;
+ subtype(p) = 0;
+ display_mlist(p) = 0;
+ text_mlist(p) = 0;
+ script_mlist(p) = 0;
+ script_script_mlist(p) = 0;
+
+ return p;
}
+/* sec 0693 */
void show_info (void)
{
- show_node_list(mem[temp_ptr].hh.v.LH);
+ show_node_list(info(temp_ptr));
}
+/* sec 0704 */
halfword fraction_rule_(scaled t)
{
- register halfword Result;
halfword p;
+
p = new_rule();
- mem[p + 3].cint = t;
- mem[p + 2].cint = 0;
- Result = p;
- return Result;
+ 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;
+ four_quarters 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;
-}
-scaled height_plus_depth_(internal_font_number f, fquarterword c)
+ link(p) = list_ptr(b);
+ list_ptr(b) = p;
+ height(b) = height(p);
+}
+/* sec 0712 */
+scaled height_plus_depth_(internal_font_number f, quarterword c)
{
- register scaled Result;
- ffourquarters q;
+ four_quarters 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;
halfword b;
internal_font_number f, g;
quarterword c, x, y;
integer m, n;
scaled u;
scaled w;
- ffourquarters q;
- ffourquarters r;
+ four_quarters q;
+ four_quarters r;
eight_bits hd;
/* small_number z; */
int z; /* 95/Jan/7 */
-/* bool largeattempt; */
- int largeattempt; /* 95/Jan/7 */
- f = 0;
+/* boolean 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;
- while (true) {
- if ((z != 0) || (x != 0)) {
+ 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])) {
+
+ do
+ {
+ z = z - 16;
+ g = fam_fnt(z);
+
+ if (g != null_font)
+ {
+ y = x;
+
+ if ((y >= font_bc[g]) && (y <= font_ec[g]))
+ {
lab22:
- q = font_info[char_base[g]+ y].qqqq;
- if ((q.b0 > 0)) {
- if (((q.b2) % 4) == 3) {
- 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)
+ q = char_info(g, y);
+
+ if ((q.b0 > 0))
+ {
+ 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;
- {
- register integer for_end;
- m = 1;
- for_end = n;
- if (m <= for_end) do
- stack_into_box(b, f, c);
- while (m++ < for_end);
- }
- c = r.b1;
- if (c != 0) {
- stack_into_box(b, f, c);
- c = r.b3;
- {
- register integer for_end;
- m = 1;
- for_end = n;
- if (m <= for_end) do
- stack_into_box(b, f, c);
- while(m++ < for_end);
- }
- }
- c = r.b0;
- if (c != 0)
+
+ 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);
- 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