home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Atari FTP
/
ATARI_FTP_0693.zip
/
ATARI_FTP_0693
/
Tex
/
texsrc.arc
/
TEX0.C
< prev
next >
Wrap
C/C++ Source or Header
|
1988-09-14
|
48KB
|
2,068 lines
overlay "tex0"
#define EXTERN extern
#include "texd.h"
initialize () { r_initialize
quarterword i ;
integer k ;
hyphpointer z ;
xchr [ 32 ] = ' ' ;
xchr [ 33 ] = '!' ;
xchr [ 34 ] = '"' ;
xchr [ 35 ] = '#' ;
xchr [ 36 ] = '$' ;
xchr [ 37 ] = '%' ;
xchr [ 38 ] = '&' ;
xchr [ 39 ] = '\'' ;
xchr [ 40 ] = '(' ;
xchr [ 41 ] = ')' ;
xchr [ 42 ] = '*' ;
xchr [ 43 ] = '+' ;
xchr [ 44 ] = ',' ;
xchr [ 45 ] = '-' ;
xchr [ 46 ] = '.' ;
xchr [ 47 ] = '/' ;
xchr [ 48 ] = '0' ;
xchr [ 49 ] = '1' ;
xchr [ 50 ] = '2' ;
xchr [ 51 ] = '3' ;
xchr [ 52 ] = '4' ;
xchr [ 53 ] = '5' ;
xchr [ 54 ] = '6' ;
xchr [ 55 ] = '7' ;
xchr [ 56 ] = '8' ;
xchr [ 57 ] = '9' ;
xchr [ 58 ] = ':' ;
xchr [ 59 ] = ';' ;
xchr [ 60 ] = '<' ;
xchr [ 61 ] = '=' ;
xchr [ 62 ] = '>' ;
xchr [ 63 ] = '?' ;
xchr [ 64 ] = '@' ;
xchr [ 65 ] = 'A' ;
xchr [ 66 ] = 'B' ;
xchr [ 67 ] = 'C' ;
xchr [ 68 ] = 'D' ;
xchr [ 69 ] = 'E' ;
xchr [ 70 ] = 'F' ;
xchr [ 71 ] = 'G' ;
xchr [ 72 ] = 'H' ;
xchr [ 73 ] = 'I' ;
xchr [ 74 ] = 'J' ;
xchr [ 75 ] = 'K' ;
xchr [ 76 ] = 'L' ;
xchr [ 77 ] = 'M' ;
xchr [ 78 ] = 'N' ;
xchr [ 79 ] = 'O' ;
xchr [ 80 ] = 'P' ;
xchr [ 81 ] = 'Q' ;
xchr [ 82 ] = 'R' ;
xchr [ 83 ] = 'S' ;
xchr [ 84 ] = 'T' ;
xchr [ 85 ] = 'U' ;
xchr [ 86 ] = 'V' ;
xchr [ 87 ] = 'W' ;
xchr [ 88 ] = 'X' ;
xchr [ 89 ] = 'Y' ;
xchr [ 90 ] = 'Z' ;
xchr [ 91 ] = '[' ;
xchr [ 92 ] = '\\' ;
xchr [ 93 ] = ']' ;
xchr [ 94 ] = '^' ;
xchr [ 95 ] = '_' ;
xchr [ 96 ] = '`' ;
xchr [ 97 ] = 'a' ;
xchr [ 98 ] = 'b' ;
xchr [ 99 ] = 'c' ;
xchr [ 100 ] = 'd' ;
xchr [ 101 ] = 'e' ;
xchr [ 102 ] = 'f' ;
xchr [ 103 ] = 'g' ;
xchr [ 104 ] = 'h' ;
xchr [ 105 ] = 'i' ;
xchr [ 106 ] = 'j' ;
xchr [ 107 ] = 'k' ;
xchr [ 108 ] = 'l' ;
xchr [ 109 ] = 'm' ;
xchr [ 110 ] = 'n' ;
xchr [ 111 ] = 'o' ;
xchr [ 112 ] = 'p' ;
xchr [ 113 ] = 'q' ;
xchr [ 114 ] = 'r' ;
xchr [ 115 ] = 's' ;
xchr [ 116 ] = 't' ;
xchr [ 117 ] = 'u' ;
xchr [ 118 ] = 'v' ;
xchr [ 119 ] = 'w' ;
xchr [ 120 ] = 'x' ;
xchr [ 121 ] = 'y' ;
xchr [ 122 ] = 'z' ;
xchr [ 123 ] = '{' ;
xchr [ 124 ] = '|' ;
xchr [ 125 ] = '}' ;
xchr [ 126 ] = '~' ;
xchr [ 0 ] = ' ' ;
xchr [ 127 ] = ' ' ;
for ( i = 1 ; i <= 31 ; i ++ )
xchr [ i ] = chr ( i ) ;
for ( i = 0 ; i <= 127 ; i ++ )
xord [ chr ( i ) ] = 127 ;
for ( i = 1 ; i <= 126 ; i ++ )
xord [ xchr [ i ] ] = i ;
interaction = 3 ;
deletionsall = true ;
errorcount = 0 ;
helpptr = 0 ;
useerrhelp = false ;
interrupt = 0 ;
OKtointerrup = true ;
#ifdef DEBUG
wasmemend = memmin ;
waslomax = memmin ;
washimin = memmax ;
panicking = false ;
#endif /* DEBUG */
nestptr = 0 ;
maxneststack = 0 ;
curlist .modefield = 1 ;
curlist .headfield = memtop - 1 ;
curlist .tailfield = memtop - 1 ;
curlist .auxfield = - 65536000 ;
curlist .mlfield = 0 ;
curlist .pgfield = 0 ;
shownmode = 0 ;
pagecontents = 0 ;
pagetail = memtop - 2 ;
mem [(long) memtop - 2 ] .hh .v.RH = 0 ;
lastglue = 65535L ;
lastpenalty = 0 ;
lastkern = 0 ;
pagesofar [ 7 ] = 0 ;
pagemaxdepth = 0 ;
for ( k = 5267 ; k <= 5976 ; k ++ )
xeqlevel [ k ] = 1 ;
nonewcontrol = true ;
hash [ 258 ] .v.LH = 0 ;
hash [ 258 ] .v.RH = 0 ;
for ( k = 259 ; k <= 3524 ; k ++ )
hash [ k ] = hash [ 258 ] ;
saveptr = 0 ;
curlevel = 1 ;
curgroup = 0 ;
curboundary = 0 ;
maxsavestack = 0 ;
magset = 0 ;
curmark [ 0 ] = 0 ;
curmark [ 1 ] = 0 ;
curmark [ 2 ] = 0 ;
curmark [ 3 ] = 0 ;
curmark [ 4 ] = 0 ;
curval = 0 ;
curvallevel = 0 ;
radix = 0 ;
for ( k = 0 ; k <= 16 ; k ++ )
readopen [ k ] = 2 ;
condptr = 0 ;
iflimit = 0 ;
curif = 0 ;
ifline = 0 ;
TEXformatdef = " plain.fmt" ;
for ( k = 0 ; k <= fontmax ; k ++ )
fontused [ k ] = false ;
nullcharacte .b0 = 0 ;
nullcharacte .b1 = 0 ;
nullcharacte .b2 = 0 ;
nullcharacte .b3 = 0 ;
totalpages = 0 ;
maxv = 0 ;
maxh = 0 ;
maxpush = 0 ;
lastbop = - 1 ;
doingleaders = false ;
deadcycles = 0 ;
curs = - 1 ;
halfbuf = dvibufsize / 2 ;
dvilimit = dvibufsize ;
dviptr = 0 ;
dvioffset = 0 ;
dvigone = 0 ;
downptr = 0 ;
rightptr = 0 ;
adjusttail = 0 ;
packbeginlin = 0 ;
emptyfield .v.RH = 0 ;
emptyfield .v.LH = 0 ;
nulldelimite .b0 = 0 ;
nulldelimite .b1 = 0 ;
nulldelimite .b2 = 0 ;
nulldelimite .b3 = 0 ;
alignptr = 0 ;
curalign = 0 ;
curspan = 0 ;
curloop = 0 ;
curhead = 0 ;
curtail = 0 ;
for ( z = 0 ; z <= 307 ; z ++ )
{
hyphword [ z ] = 0 ;
hyphlist [ z ] = 0 ;
}
hyphcount = 0 ;
outputactive = false ;
insertpenalt = 0 ;
aftertoken = 0 ;
longhelpseen = false ;
formatident = 0 ;
for ( k = 0 ; k <= 17 ; k ++ )
writeopen [ k ] = false ;
editnamestar = 0 ;
#ifdef INITEX
for ( k = 1 ; k <= 19 ; k ++ )
mem [(long) k ] .cint = 0 ;
k = 0 ;
while ( k <= 19 ) {
mem [(long) k ] .hh .v.RH = 1 ;
mem [(long) k ] .hh.b0 = 0 ;
mem [(long) k ] .hh.b1 = 0 ;
k = k + 4 ;
}
mem [(long) 6 ] .cint = 65536L ;
mem [(long) 4 ] .hh.b0 = 1 ;
mem [(long) 10 ] .cint = 65536L ;
mem [(long) 8 ] .hh.b0 = 2 ;
mem [(long) 14 ] .cint = 65536L ;
mem [(long) 12 ] .hh.b0 = 1 ;
mem [(long) 15 ] .cint = 65536L ;
mem [(long) 12 ] .hh.b1 = 1 ;
mem [(long) 18 ] .cint = - 65536L ;
mem [(long) 16 ] .hh.b0 = 1 ;
rover = 20 ;
mem [(long) rover ] .hh .v.RH = 65535L ;
mem [(long) rover ] .hh .v.LH = 1000 ;
mem [(long) rover + 1 ] .hh .v.LH = rover ;
mem [(long) rover + 1 ] .hh .v.RH = rover ;
lomemmax = rover + 1000 ;
mem [(long) lomemmax ] .hh .v.RH = 0 ;
mem [(long) lomemmax ] .hh .v.LH = 0 ;
for ( k = memtop - 13 ; k <= memtop ; k ++ )
mem [(long) k ] = mem [(long) lomemmax ] ;
mem [(long) memtop - 10 ] .hh .v.LH = 7359 ;
mem [(long) memtop - 9 ] .hh .v.RH = 256 ;
mem [(long) memtop - 9 ] .hh .v.LH = 0 ;
mem [(long) memtop - 7 ] .hh.b0 = 1 ;
mem [(long) memtop - 6 ] .hh .v.LH = 65535L ;
mem [(long) memtop - 7 ] .hh.b1 = 0 ;
mem [(long) memtop ] .hh.b1 = 255 ;
mem [(long) memtop ] .hh.b0 = 1 ;
mem [(long) memtop ] .hh .v.RH = memtop ;
mem [(long) memtop - 2 ] .hh.b0 = 10 ;
mem [(long) memtop - 2 ] .hh.b1 = 0 ;
avail = 0 ;
memend = memtop ;
himemmin = memtop - 13 ;
varused = 20 ;
dynused = 14 ;
eqtb [ 3525 ] .hh.b0 = 100 ;
eqtb [ 3525 ] .hh .v.RH = 0 ;
eqtb [ 3525 ] .hh.b1 = 0 ;
for ( k = 1 ; k <= 3524 ; k ++ )
eqtb [ k ] = eqtb [ 3525 ] ;
eqtb [ 3526 ] .hh .v.RH = 0 ;
eqtb [ 3526 ] .hh.b1 = 1 ;
eqtb [ 3526 ] .hh.b0 = 116 ;
for ( k = 3527 ; k <= 4055 ; k ++ )
eqtb [ k ] = eqtb [ 3526 ] ;
mem [(long) 0 ] .hh .v.RH = mem [(long) 0 ] .hh .v.RH + 530 ;
eqtb [ 4056 ] .hh .v.RH = 0 ;
eqtb [ 4056 ] .hh.b0 = 117 ;
eqtb [ 4056 ] .hh.b1 = 1 ;
for ( k = 4057 ; k <= 4321 ; k ++ )
eqtb [ k ] = eqtb [ 3525 ] ;
eqtb [ 4322 ] .hh .v.RH = 0 ;
eqtb [ 4322 ] .hh.b0 = 118 ;
eqtb [ 4322 ] .hh.b1 = 1 ;
for ( k = 4323 ; k <= 4577 ; k ++ )
eqtb [ k ] = eqtb [ 4322 ] ;
eqtb [ 4578 ] .hh .v.RH = 0 ;
eqtb [ 4578 ] .hh.b0 = 119 ;
eqtb [ 4578 ] .hh.b1 = 1 ;
for ( k = 4579 ; k <= 4626 ; k ++ )
eqtb [ k ] = eqtb [ 4578 ] ;
eqtb [ 4627 ] .hh .v.RH = 0 ;
eqtb [ 4627 ] .hh.b0 = 119 ;
eqtb [ 4627 ] .hh.b1 = 1 ;
for ( k = 4628 ; k <= 5266 ; k ++ )
eqtb [ k ] = eqtb [ 4627 ] ;
for ( k = 0 ; k <= 127 ; k ++ )
{
eqtb [ 4627 + k ] .hh .v.RH = 12 ;
eqtb [ 5139 + k ] .hh .v.RH = k ;
eqtb [ 5011 + k ] .hh .v.RH = 1000 ;
}
eqtb [ 4640 ] .hh .v.RH = 5 ;
eqtb [ 4659 ] .hh .v.RH = 10 ;
eqtb [ 4719 ] .hh .v.RH = 0 ;
eqtb [ 4664 ] .hh .v.RH = 14 ;
eqtb [ 4754 ] .hh .v.RH = 15 ;
eqtb [ 4627 ] .hh .v.RH = 9 ;
for ( k = 48 ; k <= 57 ; k ++ )
eqtb [ 5139 + k ] .hh .v.RH = k + 28672 ;
for ( k = 65 ; k <= 90 ; k ++ )
{
eqtb [ 4627 + k ] .hh .v.RH = 11 ;
eqtb [ 4627 + k + 32 ] .hh .v.RH = 11 ;
eqtb [ 5139 + k ] .hh .v.RH = k + 28928 ;
eqtb [ 5139 + k + 32 ] .hh .v.RH = k + 28960 ;
eqtb [ 4755 + k ] .hh .v.RH = k + 32 ;
eqtb [ 4755 + k + 32 ] .hh .v.RH = k + 32 ;
eqtb [ 4883 + k ] .hh .v.RH = k ;
eqtb [ 4883 + k + 32 ] .hh .v.RH = k ;
eqtb [ 5011 + k ] .hh .v.RH = 999 ;
}
for ( k = 5267 ; k <= 5572 ; k ++ )
eqtb [ k ] .cint = 0 ;
eqtb [ 5284 ] .cint = 1000 ;
eqtb [ 5268 ] .cint = 10000 ;
eqtb [ 5308 ] .cint = 1 ;
eqtb [ 5307 ] .cint = 25 ;
eqtb [ 5312 ] .cint = 92 ;
eqtb [ 5315 ] .cint = 13 ;
for ( k = 0 ; k <= 127 ; k ++ )
eqtb [ 5573 + k ] .cint = - 1 ;
eqtb [ 5619 ] .cint = 0 ;
for ( k = 5701 ; k <= 5976 ; k ++ )
eqtb [ k ] .cint = 0 ;
hashused = 3258 ;
cscount = 0 ;
eqtb [ 3267 ] .hh.b0 = 115 ;
hash [ 3267 ] .v.RH = 361 ;
fontptr = 0 ;
fmemptr = 7 ;
fontname [ 0 ] = 654 ;
fontarea [ 0 ] = 206 ;
hyphenchar [ 0 ] = 45 ;
skewchar [ 0 ] = - 1 ;
fontbc [ 0 ] = 1 ;
fontec [ 0 ] = 0 ;
fontsize [ 0 ] = 0 ;
fontdsize [ 0 ] = 0 ;
charbase [ 0 ] = 0 ;
widthbase [ 0 ] = 0 ;
heightbase [ 0 ] = 0 ;
depthbase [ 0 ] = 0 ;
italicbase [ 0 ] = 0 ;
ligkernbase [ 0 ] = 0 ;
kernbase [ 0 ] = 0 ;
extenbase [ 0 ] = 0 ;
fontglue [ 0 ] = 0 ;
fontparams [ 0 ] = 7 ;
parambase [ 0 ] = - 1 ;
for ( k = 0 ; k <= 6 ; k ++ )
fontinfo [ k ] .cint = 0 ;
trieopptr = 0 ;
trie [ 0 ] .v.RH = 0 ;
trie [ 0 ] .b1 = 0 ;
trie [ 0 ] .b0 = 0 ;
for ( k = 1 ; k <= 127 ; k ++ )
trie [ k ] = trie [ 0 ] ;
triemax = 127 ;
hash [ 3258 ] .v.RH = 1038 ;
formatident = 1103 ;
hash [ 3266 ] .v.RH = 1138 ;
eqtb [ 3266 ] .hh.b1 = 1 ;
eqtb [ 3266 ] .hh.b0 = 112 ;
eqtb [ 3266 ] .hh .v.RH = 0 ;
#endif /* INITEX */
}
println () { r_println
switch ( selector )
{case 19 :
{
putc('\n', output );
putc('\n', logfile );
termoffset = 0 ;
fileoffset = 0 ;
}
break ;
case 18 :
{
putc('\n', logfile );
fileoffset = 0 ;
}
break ;
case 17 :
{
putc('\n', output );
termoffset = 0 ;
}
break ;
case 16 :
case 20 :
case 21 :
;
break ;
default :
putc('\n', writefile [ selector ] );
break ;
}
}
zprintchar ( s )
ASCIIcode s ;
{/* 10 */ r_printchar
if ( s == eqtb [ 5316 ] .cint )
if ( selector < 20 )
{
println () ;
return ;
}
switch ( selector )
{case 19 :
{
putc( xchr [ s ] , output );
putc( xchr [ s ] , logfile );
incr ( termoffset ) ;
incr ( fileoffset ) ;
if ( termoffset == maxprintline )
{
putc('\n', output );
termoffset = 0 ;
}
if ( fileoffset == maxprintline )
{
putc('\n', logfile );
fileoffset = 0 ;
}
}
break ;
case 18 :
{
putc( xchr [ s ] , logfile );
incr ( fileoffset ) ;
if ( fileoffset == maxprintline )
println () ;
}
break ;
case 17 :
{
putc( xchr [ s ] , output );
incr ( termoffset ) ;
if ( termoffset == maxprintline )
println () ;
}
break ;
case 16 :
;
break ;
case 20 :
if ( tally < trickcount )
trickbuf [ tally % errorline ] = s ;
break ;
case 21 :
{
if ( poolptr < poolsize )
{
strpool [ poolptr ] = s ;
incr ( poolptr ) ;
}
}
break ;
default :
putc( xchr [ s ] , writefile [ selector ] );
break ;
}
incr ( tally ) ;
}
zprint ( s )
integer s ;
{/* 10 */ r_print
poolpointer j ;
if ( s >= strptr )
s = 130 ;
else if ( s < 128 )
if ( s < 0 )
s = 130 ;
else if ( ( s == eqtb [ 5316 ] .cint ) )
if ( selector < 20 )
{
println () ;
return ;
}
j = strstart [ s ] ;
while ( j < strstart [ s + 1 ] ) {
printchar ( strpool [ j ] ) ;
incr ( j ) ;
}
}
zslowprint ( s )
integer s ;
{/* 10 */ r_slowprint
poolpointer j ;
if ( s >= strptr )
s = 130 ;
else if ( s < 128 )
if ( s < 0 )
s = 130 ;
else if ( ( s == eqtb [ 5316 ] .cint ) )
if ( selector < 20 )
{
println () ;
return ;
}
j = strstart [ s ] ;
while ( j < strstart [ s + 1 ] ) {
print ( strpool [ j ] ) ;
incr ( j ) ;
}
}
zprintnl ( s )
strnumber s ;
{r_printnl
if ( ( ( termoffset > 0 ) && ( odd ( selector ) ) ) || ( ( fileoffset > 0 )
&& ( selector >= 18 ) ) )
println () ;
print ( s ) ;
}
zprintesc ( s )
strnumber s ;
{r_printesc
integer c ;
c = eqtb [ 5312 ] .cint ;
if ( c >= 0 )
if ( c < 128 )
print ( c ) ;
print ( s ) ;
}
zprintthedigs ( k )
eightbits k ;
{r_printthedigs
while ( k > 0 ) {
decr ( k ) ;
if ( dig [ k ] < 10 )
printchar ( 48 + dig [ k ] ) ;
else printchar ( 55 + dig [ k ] ) ;
}
}
zprintint ( n )
integer n ;
{r_printint
quarterword k ;
integer m ;
k = 0 ;
if ( n < 0 )
{
printchar ( 45 ) ;
if ( n > - 100000000 )
n = - n ;
else {
m = - 1 - n ;
n = m / 10 ;
m = ( m % 10 ) + 1 ;
k = 1 ;
if ( m < 10 )
dig [ 0 ] = m ;
else {
dig [ 0 ] = 0 ;
incr ( n ) ;
}
}
}
do { dig [ k ] = n % 10 ;
n = n / 10 ;
incr ( k ) ;
} while ( ! ( n == 0 ) ) ;
printthedigs ( k ) ;
}
zprintcs ( p )
integer p ;
{r_printcs
if ( p < 258 )
if ( p >= 129 )
if ( p == 257 )
{
printesc ( 363 ) ;
printesc ( 364 ) ;
}
else {
printesc ( p - 129 ) ;
if ( eqtb [ 4627 + p - 129 ] .hh .v.RH == 11 )
printchar ( 32 ) ;
}
else if ( p < 1 )
printesc ( 365 ) ;
else print ( p - 1 ) ;
else if ( p >= 3525 )
printesc ( 365 ) ;
else if ( ( hash [ p ] .v.RH < 0 ) || ( hash [ p ] .v.RH >= strptr ) )
printesc ( 366 ) ;
else {
printesc ( 206 ) ;
slowprint ( hash [ p ] .v.RH ) ;
printchar ( 32 ) ;
}
}
zsprintcs ( p )
halfword p ;
{r_sprintcs
if ( p < 258 )
if ( p < 129 )
print ( p - 1 ) ;
else if ( p < 257 )
printesc ( p - 129 ) ;
else {
printesc ( 363 ) ;
printesc ( 364 ) ;
}
else {
printesc ( 206 ) ;
slowprint ( hash [ p ] .v.RH ) ;
}
}
zprintfilenam ( n , a , e )
integer n , a , e ;
{r_printfilenam
print ( a ) ;
print ( n ) ;
print ( e ) ;
}
zprintsize ( s )
integer s ;
{r_printsize
if ( s == 0 )
printesc ( 277 ) ;
else if ( s == 16 )
printesc ( 278 ) ;
else printesc ( 279 ) ;
}
zprintwritewh ( s , p )
strnumber s ;
halfword p ;
{r_printwritewh
printesc ( s ) ;
if ( mem [(long) p + 1 ] .hh .v.LH < 16 )
printint ( mem [(long) p + 1 ] .hh .v.LH ) ;
else if ( mem [(long) p + 1 ] .hh .v.LH == 16 )
printchar ( 42 ) ;
else printchar ( 45 ) ;
}
#ifdef DEBUG
#endif /* DEBUG */
jumpout () { r_jumpout
closefilesan () ;
{
termflush ( output ) ;
readyalready = 0 ;
if ( ( history != 0 ) && ( history != 1 ) )
uexit ( 1 ) ;
else uexit ( 0 ) ;
}
}
error () { /* 22 10 */ r_error
ASCIIcode c ;
integer s1, s2, s3, s4 ;
if ( history < 2 )
history = 2 ;
printchar ( 46 ) ;
showcontext () ;
if ( interaction == 3 )
while ( true ) {
lab22: clearforerro () ;
{
wakeuptermin () ;
print ( 135 ) ;
terminput () ;
}
if ( last == first )
return ;
c = buffer [ first ] ;
if ( c >= 97 )
c = c - 32 ;
switch ( c )
{case 48 :
case 49 :
case 50 :
case 51 :
case 52 :
case 53 :
case 54 :
case 55 :
case 56 :
case 57 :
if ( deletionsall )
{
s1 = curtok ;
s2 = curcmd ;
s3 = curchr ;
s4 = alignstate ;
alignstate = 1000000 ;
OKtointerrup = false ;
if ( ( last > first + 1 ) && ( buffer [ first + 1 ] >= 48 ) && (
buffer [ first + 1 ] <= 57 ) )
c = c * 10 + buffer [ first + 1 ] - 48 * 11 ;
else c = c - 48 ;
while ( c > 0 ) {
gettoken () ;
decr ( c ) ;
}
curtok = s1 ;
curcmd = s2 ;
curchr = s3 ;
alignstate = s4 ;
OKtointerrup = true ;
{
helpptr = 2 ;
helpline [ 1 ] = 148 ;
helpline [ 0 ] = 149 ;
}
showcontext () ;
goto lab22 ;
}
break ;
#ifdef DEBUG
case 68 :
{
debughelp () ;
goto lab22 ;
}
break ;
#endif /* DEBUG */
case 69 :
if ( baseptr > 0 )
{
editnamestar = strstart [ inputstack [ baseptr ] .namefield ] ;
editnameleng = strstart [ inputstack [ baseptr ] .namefield + 1 ] -
strstart [ inputstack [ baseptr ] .namefield ] ;
editline = line ;
jumpout () ;
}
break ;
case 72 :
{
if ( useerrhelp )
{
giveerrhelp () ;
useerrhelp = false ;
}
else {
if ( helpptr == 0 )
{
helpptr = 2 ;
helpline [ 1 ] = 150 ;
helpline [ 0 ] = 151 ;
}
do { decr ( helpptr ) ;
print ( helpline [ helpptr ] ) ;
println () ;
} while ( ! ( helpptr == 0 ) ) ;
}
{
helpptr = 4 ;
helpline [ 3 ] = 152 ;
helpline [ 2 ] = 151 ;
helpline [ 1 ] = 153 ;
helpline [ 0 ] = 154 ;
}
goto lab22 ;
}
break ;
case 73 :
{
beginfilerea () ;
if ( last > first + 1 )
{
curinput .locfield = first + 1 ;
buffer [ first ] = 32 ;
}
else {
{
wakeuptermin () ;
print ( 147 ) ;
terminput () ;
}
curinput .locfield = first ;
}
first = last ;
curinput .limitfield = last - 1 ;
return ;
}
break ;
case 81 :
case 82 :
case 83 :
{
errorcount = 0 ;
interaction = 0 + c - 81 ;
print ( 142 ) ;
switch ( c )
{case 81 :
{
printesc ( 143 ) ;
decr ( selector ) ;
}
break ;
case 82 :
printesc ( 144 ) ;
break ;
case 83 :
printesc ( 145 ) ;
break ;
}
print ( 146 ) ;
println () ;
termflush ( output ) ;
return ;
}
break ;
case 88 :
{
interaction = 2 ;
jumpout () ;
}
break ;
default :
;
break ;
}
{
print ( 136 ) ;
printnl ( 137 ) ;
printnl ( 138 ) ;
if ( baseptr > 0 )
print ( 139 ) ;
if ( deletionsall )
printnl ( 140 ) ;
printnl ( 141 ) ;
}
}
incr ( errorcount ) ;
if ( errorcount == 100 )
{
printnl ( 134 ) ;
history = 3 ;
jumpout () ;
}
if ( interaction > 0 )
decr ( selector ) ;
if ( useerrhelp )
{
println () ;
giveerrhelp () ;
}
else while ( helpptr > 0 ) {
decr ( helpptr ) ;
printnl ( helpline [ helpptr ] ) ;
}
println () ;
if ( interaction > 0 )
incr ( selector ) ;
println () ;
}
zfatalerror ( s )
strnumber s ;
{r_fatalerror
normalizesel () ;
{
if ( interaction == 3 )
wakeuptermin () ;
printnl ( 133 ) ;
print ( 156 ) ;
}
{
helpptr = 1 ;
helpline [ 0 ] = s ;
}
{
if ( interaction == 3 )
interaction = 2 ;
error () ;
#ifdef DEBUG
if ( interaction > 0 )
debughelp () ;
#endif /* DEBUG */
history = 3 ;
jumpout () ;
}
}
zoverflow ( s , n )
strnumber s ;
integer n ;
{r_overflow
normalizesel () ;
{
if ( interaction == 3 )
wakeuptermin () ;
printnl ( 133 ) ;
print ( 157 ) ;
}
print ( s ) ;
printchar ( 61 ) ;
printint ( n ) ;
printchar ( 93 ) ;
{
helpptr = 2 ;
helpline [ 1 ] = 158 ;
helpline [ 0 ] = 159 ;
}
{
if ( interaction == 3 )
interaction = 2 ;
error () ;
#ifdef DEBUG
if ( interaction > 0 )
debughelp () ;
#endif /* DEBUG */
history = 3 ;
jumpout () ;
}
}
zconfusion ( s )
strnumber s ;
{r_confusion
normalizesel () ;
if ( history < 2 )
{
{
if ( interaction == 3 )
wakeuptermin () ;
printnl ( 133 ) ;
print ( 160 ) ;
}
print ( s ) ;
printchar ( 41 ) ;
{
helpptr = 1 ;
helpline [ 0 ] = 161 ;
}
}
else {
{
if ( interaction == 3 )
wakeuptermin () ;
printnl ( 133 ) ;
print ( 162 ) ;
}
{
helpptr = 2 ;
helpline [ 1 ] = 163 ;
helpline [ 0 ] = 164 ;
}
}
{
if ( interaction == 3 )
interaction = 2 ;
error () ;
#ifdef DEBUG
if ( interaction > 0 )
debughelp () ;
#endif /* DEBUG */
history = 3 ;
jumpout () ;
}
}
boolean initterminal () { /* 10 */ register boolean Result;
r_initterminal
integer i, j ;
topenin () ;
if ( last > first )
{
curinput .locfield = first ;
while ( ( curinput .locfield < last ) && ( buffer [ curinput .locfield ]
== ' ' ) ) incr ( curinput .locfield ) ;
if ( curinput .locfield < last )
{
Result = true ;
return(Result) ;
}
}
while ( true ) {
wakeuptermin () ;
Fputs( output , "**" ) ;
termflush ( output ) ;
if ( ! inputln ( input , true ) )
{
putc('\n', output );
Fputs( output , "! End of file on the terminal... why?" ) ;
Result = false ;
return(Result) ;
}
curinput .locfield = first ;
while ( ( curinput .locfield < last ) && ( buffer [ curinput .locfield ]
== 32 ) ) incr ( curinput .locfield ) ;
if ( curinput .locfield < last )
{
Result = true ;
return(Result) ;
}
(void) fprintf( output , "%s\n", "Please type the name of your input file." ) ;
}
return(Result) ;
}
strnumber makestring () { register strnumber Result; r_makestring
if ( strptr == maxstrings )
overflow ( 129 , maxstrings - initstrptr ) ;
incr ( strptr ) ;
strstart [ strptr ] = poolptr ;
Result = strptr - 1 ;
return(Result) ;
}
boolean zstreqbuf ( s , k )
strnumber s ;
integer k ;
{/* 45 */ register boolean Result; r_streqbuf
poolpointer j ;
boolean result ;
j = strstart [ s ] ;
while ( j < strstart [ s + 1 ] ) {
if ( strpool [ j ] != buffer [ k ] )
{
result = false ;
goto lab45 ;
}
incr ( j ) ;
incr ( k ) ;
}
result = true ;
lab45: Result = result ;
return(Result) ;
}
boolean zstreqstr ( s , t )
strnumber s , t ;
{/* 45 */ register boolean Result; r_streqstr
poolpointer j, k ;
boolean result ;
result = false ;
if ( ( strstart [ s + 1 ] - strstart [ s ] ) != ( strstart [ t + 1 ] -
strstart [ t ] ) )
goto lab45 ;
j = strstart [ s ] ;
k = strstart [ t ] ;
while ( j < strstart [ s + 1 ] ) {
if ( strpool [ j ] != strpool [ k ] )
goto lab45 ;
incr ( j ) ;
incr ( k ) ;
}
result = true ;
lab45: Result = result ;
return(Result) ;
}
#ifdef INITEX
boolean getstringsst () { /* 30 10 */ register boolean Result;
r_getstringsst
quarterword k, l ;
char m, n ;
strnumber g ;
integer a ;
boolean c ;
poolptr = 0 ;
strptr = 0 ;
strstart [ 0 ] = 0 ;
for ( k = 0 ; k <= 127 ; k ++ )
{
if ( ( ( k < 32 ) || ( k > 126 ) ) )
{
{
strpool [ poolptr ] = 94 ;
incr ( poolptr ) ;
}
{
strpool [ poolptr ] = 94 ;
incr ( poolptr ) ;
}
if ( k < 64 )
{
strpool [ poolptr ] = k + 64 ;
incr ( poolptr ) ;
}
else {
strpool [ poolptr ] = k - 64 ;
incr ( poolptr ) ;
}
}
else {
strpool [ poolptr ] = k ;
incr ( poolptr ) ;
}
g = makestring () ;
}
vstrcpy ( nameoffile + 1 , poolname ) ;
if ( aopenin ( poolfile , poolpathspec ) )
{
c = false ;
do { {
if ( eof ( poolfile ) )
{
wakeuptermin () ;
(void) fprintf( output , "%s\n", "! tex.pool has no check sum." ) ;
aclose ( poolfile ) ;
Result = false ;
return(Result) ;
}
read ( poolfile , m ) ;
read ( poolfile , n ) ;
if ( m == '*' )
{
a = 0 ;
k = 1 ;
while ( true ) {
if ( ( xord [ n ] < 48 ) || ( xord [ n ] > 57 ) )
{
wakeuptermin () ;
(void) fprintf( output , "%s\n", "! tex.pool check sum doesn't have nine digits." ) ;
aclose ( poolfile ) ;
Result = false ;
return(Result) ;
}
a = 10 * a + xord [ n ] - 48 ;
if ( k == 9 )
goto lab30 ;
incr ( k ) ;
read ( poolfile , n ) ;
}
lab30: if ( a != 13634946 )
{
wakeuptermin () ;
(void) fprintf( output , "%s\n", "! tex.pool doesn't match; tangle me again." )
;
aclose ( poolfile ) ;
Result = false ;
return(Result) ;
}
c = true ;
}
else {
if ( ( xord [ m ] < 48 ) || ( xord [ m ] > 57 ) || ( xord [ n ] < 48
) || ( xord [ n ] > 57 ) )
{
wakeuptermin () ;
(void) fprintf( output , "%s\n", "! tex.pool line doesn't begin with two digits." ) ;
aclose ( poolfile ) ;
Result = false ;
return(Result) ;
}
l = xord [ m ] * 10 + xord [ n ] - 48 * 11 ;
if ( poolptr + l + stringvacanc > poolsize )
{
wakeuptermin () ;
(void) fprintf( output , "%s\n", "! You have to increase POOLSIZE." ) ;
aclose ( poolfile ) ;
Result = false ;
return(Result) ;
}
for ( k = 1 ; k <= l ; k ++ )
{
if ( eoln ( poolfile ) )
m = ' ' ;
else read ( poolfile , m ) ;
{
strpool [ poolptr ] = xord [ m ] ;
incr ( poolptr ) ;
}
}
readln ( poolfile ) ;
g = makestring () ;
}
}
} while ( ! ( c ) ) ;
aclose ( poolfile ) ;
Result = true ;
}
else {
wakeuptermin () ;
(void) fprintf( output , "%s\n", "! I can't read tex.pool." ) ;
Result = false ;
return(Result) ;
}
return(Result) ;
}
#endif /* INITEX */
zprinttwo ( n )
integer n ;
{r_printtwo
n = abs ( n ) % 100 ;
printchar ( 48 + ( n / 10 ) ) ;
printchar ( 48 + ( n % 10 ) ) ;
}
zprinthex ( n )
integer n ;
{r_printhex
quarterword k ;
k = 0 ;
printchar ( 34 ) ;
do { dig [ k ] = n % 16 ;
n = n / 16 ;
incr ( k ) ;
} while ( ! ( n == 0 ) ) ;
printthedigs ( k ) ;
}
zprintASCII ( c )
integer c ;
{r_printASCII
if ( ( c >= 0 ) && ( c <= 127 ) )
print ( c ) ;
else {
printchar ( 91 ) ;
if ( c < 0 )
printint ( c ) ;
else printhex ( c ) ;
printchar ( 93 ) ;
}
}
zprintromanin ( n )
integer n ;
{/* 10 */ r_printromanin
poolpointer j, k ;
nonnegativei u, v ;
j = strstart [ 131 ] ;
v = 1000 ;
while ( true ) {
while ( n >= v ) {
printchar ( strpool [ j ] ) ;
n = n - v ;
}
if ( n <= 0 )
return ;
k = j + 2 ;
u = v / ( strpool [ k - 1 ] - 48 ) ;
if ( strpool [ k - 1 ] == 50 )
{
k = k + 2 ;
u = u / ( strpool [ k - 1 ] - 48 ) ;
}
if ( n + u >= v )
{
printchar ( strpool [ k ] ) ;
n = n + u ;
}
else {
j = j + 2 ;
v = v / ( strpool [ j - 1 ] - 48 ) ;
}
}
}
printcurrent () { r_printcurrent
poolpointer j ;
j = strstart [ strptr ] ;
while ( j < poolptr ) {
printchar ( strpool [ j ] ) ;
incr ( j ) ;
}
}
terminput () { r_terminput
integer k ;
termflush ( output ) ;
if ( ! inputln ( input , true ) )
fatalerror ( 132 ) ;
termoffset = 0 ;
decr ( selector ) ;
if ( last != first )
for ( k = first ; k <= last - 1 ; k ++ )
print ( buffer [ k ] ) ;
println () ;
incr ( selector ) ;
}
zinterror ( n )
integer n ;
{r_interror
print ( 155 ) ;
printint ( n ) ;
printchar ( 41 ) ;
error () ;
}
normalizesel () { r_normalizesel
if ( jobname > 0 )
selector = 19 ;
else selector = 17 ;
if ( jobname == 0 )
openlogfile () ;
if ( interaction == 0 )
decr ( selector ) ;
}
pauseforinst () { r_pauseforinst
if ( OKtointerrup )
{
interaction = 3 ;
if ( ( selector == 18 ) || ( selector == 16 ) )
incr ( selector ) ;
{
if ( interaction == 3 )
wakeuptermin () ;
printnl ( 133 ) ;
print ( 165 ) ;
}
{
helpptr = 3 ;
helpline [ 2 ] = 166 ;
helpline [ 1 ] = 167 ;
helpline [ 0 ] = 168 ;
}
deletionsall = false ;
error () ;
deletionsall = true ;
interrupt = 0 ;
}
}
integer zhalf ( x )
integer x ;
{register integer Result; r_half
if ( odd ( x ) )
Result = ( x + 1 ) / 2 ;
else Result = x / 2 ;
return(Result) ;
}
scaled zrounddecimal ( k )
smallnumber k ;
{register scaled Result; r_rounddecimal
integer a ;
a = 0 ;
while ( k > 0 ) {
decr ( k ) ;
a = ( a + dig [ k ] * 131072 ) / 10 ;
}
Result = ( a + 1 ) / 2 ;
return(Result) ;
}
zprintscaled ( s )
scaled s ;
{r_printscaled
scaled delta ;
if ( s < 0 )
{
printchar ( 45 ) ;
s = - s ;
}
printint ( s / 65536 ) ;
printchar ( 46 ) ;
s = 10 * ( s % 65536 ) + 5 ;
delta = 10 ;
do { if ( delta > 65536 )
s = s + 32768L - ( delta / 2 ) ;
printchar ( 48 + ( s / 65536 ) ) ;
s = 10 * ( s % 65536 ) ;
delta = delta * 10 ;
} while ( ! ( s <= delta ) ) ;
}
scaled znxplusy ( n , x , y )
integer n ;
scaled x , y ;
{register scaled Result; r_nxplusy
if ( n < 0 )
{
x = - x ;
n = - n ;
}
if ( n == 0 )
Result = y ;
else if ( ( ( x <= ( 1073741823 - y ) / n ) && ( - x <= ( 1073741823 + y ) /
n ) ) )
Result = n * x + y ;
else {
aritherror = true ;
Result = 0 ;
}
return(Result) ;
}
scaled zxovern ( x , n )
scaled x ;
integer n ;
{register scaled Result; r_xovern
boolean negative ;
negative = false ;
if ( n == 0 )
{
aritherror = true ;
Result = 0 ;
remainder = x ;
}
else {
if ( n < 0 )
{
x = - x ;
n = - n ;
negative = true ;
}
if ( x >= 0 )
{
Result = x / n ;
remainder = x % n ;
}
else {
Result = - ( ( - x ) / n ) ;
remainder = - ( ( - x ) % n ) ;
}
}
if ( negative )
remainder = - remainder ;
return(Result) ;
}
scaled zxnoverd ( x , n , d )
scaled x ;
integer n , d ;
{register scaled Result; r_xnoverd
boolean positive ;
nonnegativei t, u, v ;
if ( x >= 0 )
positive = true ;
else {
x = - x ;
positive = false ;
}
t = ( x % 32768L ) * n ;
u = ( x / 32768L ) * n + ( t / 32768L ) ;
v = ( u % d ) * 32768 + ( t % 32768 ) ;
if ( u / d >= 32768 )
aritherror = true ;
else u = 32768L * ( u / d ) + ( v / d ) ;
if ( positive )
{
Result = u ;
remainder = v % d ;
}
else {
Result = - u ;
remainder = - ( v % d ) ;
}
return(Result) ;
}
halfword zbadness ( t , s )
scaled t , s ;
{register halfword Result; r_badness
integer r ;
if ( t == 0 )
Result = 0 ;
else if ( s <= 0 )
Result = 10000 ;
else {
if ( t <= 7230584 )
r = ( t * 297 ) / s ;
else if ( s >= 1663497 )
r = t / ( s / 297 ) ;
else r = t ;
if ( r > 1290 )
Result = 10000 ;
else Result = ( r * r * r + 131072 ) / 262144 ;
}
return(Result) ;
}
#ifdef DEBUG
zprintword ( w )
memoryword w ;
{r_printword
printint ( w .cint ) ;
printchar ( 32 ) ;
printscaled ( w .cint ) ;
printchar ( 32 ) ;
printscaled ( round ( 65536 * w .gr ) ) ;
println () ;
printint ( w .hh .v.LH ) ;
printchar ( 61 ) ;
printint ( w .hh.b0 ) ;
printchar ( 58 ) ;
printint ( w .hh.b1 ) ;
printchar ( 59 ) ;
printint ( w .hh .v.RH ) ;
printchar ( 32 ) ;
printint ( w .qqqq .b0 ) ;
printchar ( 58 ) ;
printint ( w .qqqq .b1 ) ;
printchar ( 58 ) ;
printint ( w .qqqq .b2 ) ;
printchar ( 58 ) ;
printint ( w .qqqq .b3 ) ;
}
#endif /* DEBUG */
zshowtokenlis ( p , q , l )
integer p , q ;
integer l ;
{/* 10 */ r_showtokenlis
integer m, c ;
ASCIIcode matchchr ;
ASCIIcode n ;
matchchr = 35 ;
n = 48 ;
tally = 0 ;
while ( ( p != 0 ) && ( tally < l ) ) {
if ( p == q )
{
firstcount = tally ;
trickcount = tally + 1 + errorline - halferrorlin ;
if ( trickcount < errorline )
trickcount = errorline ;
}
if ( ( p < himemmin ) || ( p > memend ) )
{
printesc ( 178 ) ;
return ;
}
if ( mem [(long) p ] .hh .v.LH >= 4096 )
printcs ( mem [(long) p ] .hh .v.LH - 4096 ) ;
else {
m = mem [(long) p ] .hh .v.LH / 256 ;
c = mem [(long) p ] .hh .v.LH % 256 ;
if ( ( mem [(long) p ] .hh .v.LH < 0 ) || ( c > 127 ) )
printesc ( 413 ) ;
else switch ( m )
{case 1 :
case 2 :
case 3 :
case 4 :
case 7 :
case 8 :
case 10 :
case 11 :
case 12 :
print ( c ) ;
break ;
case 6 :
{
print ( c ) ;
print ( c ) ;
}
break ;
case 5 :
{
print ( matchchr ) ;
if ( c <= 9 )
printchar ( c + 48 ) ;
else {
printchar ( 33 ) ;
return ;
}
}
break ;
case 13 :
{
matchchr = c ;
print ( c ) ;
incr ( n ) ;
printchar ( n ) ;
if ( n > 57 )
return ;
}
break ;
case 14 :
print ( 414 ) ;
break ;
default :
printesc ( 413 ) ;
break ;
}
}
p = mem [(long) p ] .hh .v.RH ;
}
if ( p != 0 )
printesc ( 412 ) ;
}
runaway () { r_runaway
halfword p ;
if ( scannerstatu > 1 )
{
printnl ( 427 ) ;
switch ( scannerstatu )
{case 2 :
{
print ( 428 ) ;
p = defref ;
}
break ;
case 3 :
{
print ( 429 ) ;
p = memtop - 3 ;
}
break ;
case 4 :
{
print ( 430 ) ;
p = memtop - 4 ;
}
break ;
case 5 :
{
print ( 431 ) ;
p = defref ;
}
break ;
}
printchar ( 63 ) ;
println () ;
showtokenlis ( mem [(long) p ] .hh .v.RH , 0 , errorline - 10 ) ;
}
}
halfword getavail () { register halfword Result; r_getavail
halfword p ;
p = avail ;
if ( p != 0 )
avail = mem [(long) avail ] .hh .v.RH ;
else if ( memend < memmax )
{
incr ( memend ) ;
p = memend ;
}
else {
decr ( himemmin ) ;
p = himemmin ;
if ( himemmin <= lomemmax )
{
runaway () ;
overflow ( 169 , memmax + 1 - memmin ) ;
}
}
mem [(long) p ] .hh .v.RH = 0 ;
#ifdef STAT
incr ( dynused ) ;
#endif /* STAT */
Result = p ;
return(Result) ;
}
zflushlist ( p )
halfword p ;
{r_flushlist
halfword q, r ;
if ( p != 0 )
{
r = p ;
do { q = r ;
r = mem [(long) r ] .hh .v.RH ;
#ifdef STAT
decr ( dynused ) ;
#endif /* STAT */
} while ( ! ( r == 0 ) ) ;
mem [(long) q ] .hh .v.RH = avail ;
avail = p ;
}
}
halfword zgetnode ( s )
integer s ;
{/* 40 10 20 */ register halfword Result; r_getnode
halfword p ;
halfword q ;
integer r ;
integer t ;
lab20: p = rover ;
do { q = p + mem [(long) p ] .hh .v.LH ;
while ( ( mem [(long) q ] .hh .v.RH == 65535L ) ) {
t = mem [(long) q + 1 ] .hh .v.RH ;
if ( q == rover )
rover = t ;
mem [(long) t + 1 ] .hh .v.LH = mem [(long) q + 1 ] .hh .v.LH ;
mem [(long) mem [(long) q + 1 ] .hh .v.LH + 1 ] .hh .v.RH = t ;
q = q + mem [(long) q ] .hh .v.LH ;
}
r = q - s ;
if ( r > toint ( p + 1 ) )
{
mem [(long) p ] .hh .v.LH = r - p ;
rover = p ;
goto lab40 ;
}
if ( r == p )
if ( mem [(long) p + 1 ] .hh .v.RH != p )
{
rover = mem [(long) p + 1 ] .hh .v.RH ;
t = mem [(long) p + 1 ] .hh .v.LH ;
mem [(long) rover + 1 ] .hh .v.LH = t ;
mem [(long) t + 1 ] .hh .v.RH = rover ;
goto lab40 ;
}
mem [(long) p ] .hh .v.LH = q - p ;
p = mem [(long) p + 1 ] .hh .v.RH ;
} while ( ! ( p == rover ) ) ;
if ( s == 1073741824 )
{
Result = 65535L ;
return(Result) ;
}
if ( lomemmax + 2 < himemmin )
if ( lomemmax + 2 <= 65535L )
{
if ( lomemmax + 1000 < himemmin )
t = lomemmax + 1000 ;
else t = ( lomemmax + himemmin + 2 ) / 2 ;
p = mem [(long) rover + 1 ] .hh .v.LH ;
q = lomemmax ;
mem [(long) p + 1 ] .hh .v.RH = q ;
mem [(long) rover + 1 ] .hh .v.LH = q ;
if ( t > 65535L )
t = 65535L ;
mem [(long) q + 1 ] .hh .v.RH = rover ;
mem [(long) q + 1 ] .hh .v.LH = p ;
mem [(long) q ] .hh .v.RH = 65535L ;
mem [(long) q ] .hh .v.LH = t - lomemmax ;
lomemmax = t ;
mem [(long) lomemmax ] .hh .v.RH = 0 ;
mem [(long) lomemmax ] .hh .v.LH = 0 ;
rover = q ;
goto lab20 ;
}
overflow ( 169 , memmax + 1 - memmin ) ;
lab40: mem [(long) r ] .hh .v.RH = 0 ;
#ifdef STAT
varused = varused + s ;
#endif /* STAT */
Result = r ;
return(Result) ;
}
zfreenode ( p , s )
halfword p ;
halfword s ;
{r_freenode
halfword q ;
mem [(long) p ] .hh .v.LH = s ;
mem [(long) p ] .hh .v.RH = 65535L ;
q = mem [(long) rover + 1 ] .hh .v.LH ;
mem [(long) p + 1 ] .hh .v.LH = q ;
mem [(long) p + 1 ] .hh .v.RH = rover ;
mem [(long) rover + 1 ] .hh .v.LH = p ;
mem [(long) q + 1 ] .hh .v.RH = p ;
#ifdef STAT
varused = varused - s ;
#endif /* STAT */
}
#ifdef INITEX
sortavail () { r_sortavail
halfword p, q, r ;
halfword oldrover ;
p = getnode ( 1073741824 ) ;
p = mem [(long) rover + 1 ] .hh .v.RH ;
mem [(long) rover + 1 ] .hh .v.RH = 65535L ;
oldrover = rover ;
while ( p != oldrover ) if ( p < rover )
{
q = p ;
p = mem [(long) q + 1 ] .hh .v.RH ;
mem [(long) q + 1 ] .hh .v.RH = rover ;
rover = q ;
}
else {
q = rover ;
while ( mem [(long) q + 1 ] .hh .v.RH < p ) q = mem [(long) q + 1 ] .hh .v.RH ;
r = mem [(long) p + 1 ] .hh .v.RH ;
mem [(long) p + 1 ] .hh .v.RH = mem [(long) q + 1 ] .hh .v.RH ;
mem [(long) q + 1 ] .hh .v.RH = p ;
p = r ;
}
p = rover ;
while ( mem [(long) p + 1 ] .hh .v.RH != 65535L ) {
mem [(long) mem [(long) p + 1 ] .hh .v.RH + 1 ] .hh .v.LH = p ;
p = mem [(long) p + 1 ] .hh .v.RH ;
}
mem [(long) p + 1 ] .hh .v.RH = rover ;
mem [(long) rover + 1 ] .hh .v.LH = p ;
}
#endif /* INITEX */
halfword newnullbox () { register halfword Result; r_newnullbox
halfword p ;
p = getnode ( 7 ) ;
mem [(long) p ] .hh.b0 = 0 ;
mem [(long) p ] .hh.b1 = 0 ;
mem [(long) p + 1 ] .cint = 0 ;
mem [(long) p + 2 ] .cint = 0 ;
mem [(long) p + 3 ] .cint = 0 ;
mem [(long) p + 4 ] .cint = 0 ;
mem [(long) p + 5 ] .hh .v.RH = 0 ;
mem [(long) p + 5 ] .hh.b0 = 0 ;
mem [(long) p + 5 ] .hh.b1 = 0 ;
mem [(long) p + 6 ] .gr = 0.0 ;
Result = p ;
return(Result) ;
}
halfword newrule () { register halfword Result; r_newrule
halfword p ;
p = getnode ( 4 ) ;
mem [(long) p ] .hh.b0 = 2 ;
mem [(long) p ] .hh.b1 = 0 ;
mem [(long) p + 1 ] .cint = - 1073741824 ;
mem [(long) p + 2 ] .cint = - 1073741824 ;
mem [(long) p + 3 ] .cint = - 1073741824 ;
Result = p ;
return(Result) ;
}
halfword znewligature ( f , c , q )
quarterword f , c ;
halfword q ;
{register halfword Result; r_newligature
halfword p ;
p = getnode ( 2 ) ;
mem [(long) p ] .hh.b0 = 6 ;
mem [(long) p ] .hh.b1 = 0 ;
mem [(long) p + 1 ] .hh.b0 = f ;
mem [(long) p + 1 ] .hh.b1 = c ;
mem [(long) p + 1 ] .hh .v.RH = q ;
Result = p ;
return(Result) ;
}
halfword newdisc () { register halfword Result; r_newdisc
halfword p ;
p = getnode ( 2 ) ;
mem [(long) p ] .hh.b0 = 7 ;
mem [(long) p ] .hh.b1 = 0 ;
mem [(long) p + 1 ] .hh .v.LH = 0 ;
mem [(long) p + 1 ] .hh .v.RH = 0 ;
Result = p ;
return(Result) ;
}
halfword znewmath ( w , s )
scaled w ;
smallnumber s ;
{register halfword Result; r_newmath
halfword p ;
p = getnode ( 2 ) ;
mem [(long) p ] .hh.b0 = 9 ;
mem [(long) p ] .hh.b1 = s ;
mem [(long) p + 1 ] .cint = w ;
Result = p ;
return(Result) ;
}
halfword znewspec ( p )
halfword p ;
{register halfword Result; r_newspec
halfword q ;
q = getnode ( 4 ) ;
mem [(long) q ] = mem [(long) p ] ;
mem [(long) q ] .hh .v.RH = 0 ;
mem [(long) q + 1 ] .cint = mem [(long) p + 1 ] .cint ;
mem [(long) q + 2 ] .cint = mem [(long) p + 2 ] .cint ;
mem [(long) q + 3 ] .cint = mem [(long) p + 3 ] .cint ;
Result = q ;
return(Result) ;
}
halfword znewparamglue ( n )
smallnumber n ;
{register halfword Result; r_newparamglue
halfword p ;
halfword q ;
p = getnode ( 2 ) ;
mem [(long) p ] .hh.b0 = 10 ;
mem [(long) p ] .hh.b1 = n + 1 ;
mem [(long) p + 1 ] .hh .v.RH = 0 ;
q = eqtb [ 3526 + n ] .hh .v.RH ;
mem [(long) p + 1 ] .hh .v.LH = q ;
incr ( mem [(long) q ] .hh .v.RH ) ;
Result = p ;
return(Result) ;
}
halfword znewglue ( q )
halfword q ;
{register halfword Result; r_newglue
halfword p ;
p = getnode ( 2 ) ;
mem [(long) p ] .hh.b0 = 10 ;
mem [(long) p ] .hh.b1 = 0 ;
mem [(long) p + 1 ] .hh .v.RH = 0 ;
mem [(long) p + 1 ] .hh .v.LH = q ;
incr ( mem [(long) q ] .hh .v.RH ) ;
Result = p ;
return(Result) ;
}
halfword znewskipparam ( n )
smallnumber n ;
{register halfword Result; r_newskipparam
halfword p ;
tempptr = newspec ( eqtb [ 3526 + n ] .hh .v.RH ) ;
p = newglue ( tempptr ) ;
mem [(long) tempptr ] .hh .v.RH = 0 ;
mem [(long) p ] .hh.b1 = n + 1 ;
Result = p ;
return(Result) ;
}
halfword znewkern ( w )
scaled w ;
{register halfword Result; r_newkern
halfword p ;
p = getnode ( 2 ) ;
mem [(long) p ] .hh.b0 = 11 ;
mem [(long) p ] .hh.b1 = 0 ;
mem [(long) p + 1 ] .cint = w ;
Result = p ;
return(Result) ;
}
halfword znewpenalty ( m )
integer m ;
{register halfword Result; r_newpenalty
halfword p ;
p = getnode ( 2 ) ;
mem [(long) p ] .hh.b0 = 12 ;
mem [(long) p ] .hh.b1 = 0 ;
mem [(long) p + 1 ] .cint = m ;
Result = p ;
return(Result) ;
}
#ifdef DEBUG
zcheckmem ( printlocs )
boolean printlocs ;
{/* 31 32 */ r_checkmem
halfword p, q ;
boolean clobbered ;
for ( p = memmin ; p <= lomemmax ; p ++ )
freearr [ p ] = false ;
for ( p = himemmin ; p <= memend ; p ++ )
freearr [ p ] = false ;
p = avail ;
q = 0 ;
clobbered = false ;
while ( p != 0 ) {
if ( ( p > memend ) || ( p < himemmin ) )
clobbered = true ;
else if ( freearr [ p ] )
clobbered = true ;
if ( clobbered )
{
printnl ( 170 ) ;
printint ( q ) ;
goto lab31 ;
}
freearr [ p ] = true ;
q = p ;
p = mem [(long) q ] .hh .v.RH ;
}
lab31: ;
p = rover ;
q = 0 ;
clobbered = false ;
do { if ( ( p >= lomemmax ) || ( p < memmin ) )
clobbered = true ;
else if ( ( mem [(long) p + 1 ] .hh .v.RH >= lomemmax ) || ( mem [(long) p + 1 ] .hh
.v.RH < memmin ) )
clobbered = true ;
else if ( ! ( ( mem [(long) p ] .hh .v.RH == 65535L ) ) || ( mem [(long) p ] .hh .v.LH
< 2 ) || ( p + mem [(long) p ] .hh .v.LH > lomemmax ) || ( mem [(long) mem [(long) p + 1 ]
.hh .v.RH + 1 ] .hh .v.LH != p ) )
clobbered = true ;
if ( clobbered )
{
printnl ( 171 ) ;
printint ( q ) ;
goto lab32 ;
}
for ( q = p ; q <= p + mem [(long) p ] .hh .v.LH - 1 ; q ++ )
{
if ( freearr [ q ] )
{
printnl ( 172 ) ;
printint ( q ) ;
goto lab32 ;
}
freearr [ q ] = true ;
}
q = p ;
p = mem [(long) p + 1 ] .hh .v.RH ;
} while ( ! ( p == rover ) ) ;
lab32: ;
p = memmin ;
while ( p <= lomemmax ) {
if ( ( mem [(long) p ] .hh .v.RH == 65535L ) )
{
printnl ( 173 ) ;
printint ( p ) ;
}
while ( ( p <= lomemmax ) && ! freearr [ p ] ) incr ( p ) ;
while ( ( p <= lomemmax ) && freearr [ p ] ) incr ( p ) ;
}
if ( printlocs )
{
printnl ( 174 ) ;
for ( p = memmin ; p <= lomemmax ; p ++ )
if ( ! freearr [ p ] && ( ( p > waslomax ) || wasfree [ p ] ) )
{
printchar ( 32 ) ;
printint ( p ) ;
}
for ( p = himemmin ; p <= memend ; p ++ )
if ( ! freearr [ p ] && ( ( p < washimin ) || ( p > wasmemend ) || wasfree
[ p ] ) )
{
printchar ( 32 ) ;
printint ( p ) ;
}
}
for ( p = memmin ; p <= lomemmax ; p ++ )
wasfree [ p ] = freearr [ p ] ;
for ( p = himemmin ; p <= memend ; p ++ )
wasfree [ p ] = freearr [ p ] ;
wasmemend = memend ;
waslomax = lomemmax ;
washimin = himemmin ;
}
#endif /* DEBUG */
#ifdef DEBUG
zsearchmem ( p )
halfword p ;
{ r_searchmem
integer q ;
for ( q = memmin ; q <= lomemmax ; q ++ )
{
if ( mem [(long) q ] .hh .v.RH == p )
{
printnl ( 175 ) ;
printint ( q ) ;
printchar ( 41 ) ;
}
if ( mem [(long) q ] .hh .v.LH == p )
{
printnl ( 176 ) ;
printint ( q ) ;
printchar ( 41 ) ;
}
}
for ( q = himemmin ; q <= memend ; q ++ )
{
if ( mem [(long) q ] .hh .v.RH == p )
{
printnl ( 175 ) ;
printint ( q ) ;
printchar ( 41 ) ;
}
if ( mem [(long) q ] .hh .v.LH == p )
{
printnl ( 176 ) ;
printint ( q ) ;
printchar ( 41 ) ;
}
}
for ( q = 1 ; q <= 4577 ; q ++ )
{
if ( eqtb [ q ] .hh .v.RH == p )
{
printnl ( 360 ) ;
printint ( q ) ;
printchar ( 41 ) ;
}
}
if ( saveptr > 0 )
for ( q = 0 ; q <= saveptr - 1 ; q ++ )
{
if ( savestack [ q ] .hh .v.RH == p )
{
printnl ( 404 ) ;
printint ( q ) ;
printchar ( 41 ) ;
}
}
for ( q = 0 ; q <= 307 ; q ++ )
{
if ( hyphlist [ q ] == p )
{
printnl ( 792 ) ;
printint ( q ) ;
printchar ( 41 ) ;
}
}
}
#endif /* DEBUG */