home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Atari FTP
/
ATARI_FTP_0693.zip
/
ATARI_FTP_0693
/
Tex
/
texsrc.arc
/
TEX7.C
< prev
next >
Wrap
C/C++ Source or Header
|
1988-09-14
|
54KB
|
2,043 lines
overlay "tex7"
#define EXTERN extern
#include "texd.h"
halfword zvsplit ( n , h )
eightbits n ;
scaled h ;
{/* 10 30 */ register halfword Result; r_vsplit
halfword v ;
halfword p ;
halfword q ;
v = eqtb [ 4322 + n ] .hh .v.RH ;
if ( curmark [ 3 ] != 0 )
{
deletetokenr ( curmark [ 3 ] ) ;
curmark [ 3 ] = 0 ;
deletetokenr ( curmark [ 4 ] ) ;
curmark [ 4 ] = 0 ;
}
if ( v == 0 )
{
Result = 0 ;
return(Result) ;
}
if ( mem [(long) v ] .hh.b0 != 1 )
{
{
if ( interaction == 3 )
wakeuptermin () ;
printnl ( 133 ) ;
print ( 206 ) ;
}
printesc ( 813 ) ;
print ( 814 ) ;
printesc ( 815 ) ;
{
helpptr = 2 ;
helpline [ 1 ] = 816 ;
helpline [ 0 ] = 817 ;
}
error () ;
Result = 0 ;
return(Result) ;
}
q = vertbreak ( mem [(long) v + 5 ] .hh .v.RH , h , eqtb [ 5707 ] .cint ) ;
p = mem [(long) v + 5 ] .hh .v.RH ;
if ( p == q )
mem [(long) v + 5 ] .hh .v.RH = 0 ;
else while ( true ) {
if ( mem [(long) p ] .hh.b0 == 4 )
if ( curmark [ 3 ] == 0 )
{
curmark [ 3 ] = mem [(long) p + 1 ] .cint ;
curmark [ 4 ] = curmark [ 3 ] ;
mem [(long) curmark [ 3 ] ] .hh .v.LH = mem [(long) curmark [ 3 ] ] .hh .v.LH + 2 ;
}
else {
deletetokenr ( curmark [ 4 ] ) ;
curmark [ 4 ] = mem [(long) p + 1 ] .cint ;
incr ( mem [(long) curmark [ 4 ] ] .hh .v.LH ) ;
}
if ( mem [(long) p ] .hh .v.RH == q )
{
mem [(long) p ] .hh .v.RH = 0 ;
goto lab30 ;
}
p = mem [(long) p ] .hh .v.RH ;
}
lab30: ;
q = prunepagetop ( q ) ;
p = mem [(long) v + 5 ] .hh .v.RH ;
freenode ( v , 7 ) ;
if ( q == 0 )
eqtb [ 4322 + n ] .hh .v.RH = 0 ;
else eqtb [ 4322 + n ] .hh .v.RH = vpackage ( q , 0 , 1 , 1073741823 ) ;
Result = vpackage ( p , h , 0 , eqtb [ 5707 ] .cint ) ;
return(Result) ;
}
printtotals () { r_printtotals
printscaled ( pagesofar [ 1 ] ) ;
if ( pagesofar [ 2 ] != 0 )
{
print ( 181 ) ;
printscaled ( pagesofar [ 2 ] ) ;
print ( 206 ) ;
}
if ( pagesofar [ 3 ] != 0 )
{
print ( 181 ) ;
printscaled ( pagesofar [ 3 ] ) ;
print ( 180 ) ;
}
if ( pagesofar [ 4 ] != 0 )
{
print ( 181 ) ;
printscaled ( pagesofar [ 4 ] ) ;
print ( 826 ) ;
}
if ( pagesofar [ 5 ] != 0 )
{
print ( 181 ) ;
printscaled ( pagesofar [ 5 ] ) ;
print ( 827 ) ;
}
if ( pagesofar [ 6 ] != 0 )
{
print ( 182 ) ;
printscaled ( pagesofar [ 6 ] ) ;
}
}
zfreezepagesp ( s )
smallnumber s ;
{r_freezepagesp
pagecontents = s ;
pagesofar [ 0 ] = eqtb [ 5705 ] .cint ;
pagemaxdepth = eqtb [ 5706 ] .cint ;
pagesofar [ 7 ] = 0 ;
pagesofar [ 1 ] = 0 ;
pagesofar [ 2 ] = 0 ;
pagesofar [ 3 ] = 0 ;
pagesofar [ 4 ] = 0 ;
pagesofar [ 5 ] = 0 ;
pagesofar [ 6 ] = 0 ;
leastpagecos = 1073741823 ;
#ifdef STAT
if ( eqtb [ 5300 ] .cint > 0 )
{
begindiagnos () ;
printnl ( 835 ) ;
printscaled ( pagesofar [ 0 ] ) ;
print ( 836 ) ;
printscaled ( pagemaxdepth ) ;
enddiagnosti ( false ) ;
}
#endif /* STAT */
}
zboxerror ( n )
eightbits n ;
{r_boxerror
error () ;
begindiagnos () ;
printnl ( 689 ) ;
showbox ( eqtb [ 4322 + n ] .hh .v.RH ) ;
enddiagnosti ( true ) ;
flushnodelis ( eqtb [ 4322 + n ] .hh .v.RH ) ;
eqtb [ 4322 + n ] .hh .v.RH = 0 ;
}
zensurevbox ( n )
eightbits n ;
{r_ensurevbox
halfword p ;
p = eqtb [ 4322 + n ] .hh .v.RH ;
if ( p != 0 )
if ( mem [(long) p ] .hh.b0 == 0 )
{
{
if ( interaction == 3 )
wakeuptermin () ;
printnl ( 133 ) ;
print ( 837 ) ;
}
{
helpptr = 3 ;
helpline [ 2 ] = 838 ;
helpline [ 1 ] = 839 ;
helpline [ 0 ] = 840 ;
}
boxerror ( n ) ;
}
}
zfireup ( c )
halfword c ;
{/* 10 */ r_fireup
halfword p, q, r, s ;
halfword prevp ;
quarterword n ;
boolean wait ;
integer savevbadness ;
scaled savevfuzz ;
halfword savesplittop ;
if ( mem [(long) bestpagebrea ] .hh.b0 == 12 )
{
geqworddefin ( 5306 , mem [(long) bestpagebrea + 1 ] .cint ) ;
mem [(long) bestpagebrea + 1 ] .cint = 10000 ;
}
else geqworddefin ( 5306 , 10000 ) ;
if ( curmark [ 2 ] != 0 )
{
if ( curmark [ 0 ] != 0 )
deletetokenr ( curmark [ 0 ] ) ;
curmark [ 0 ] = curmark [ 2 ] ;
incr ( mem [(long) curmark [ 0 ] ] .hh .v.LH ) ;
deletetokenr ( curmark [ 1 ] ) ;
curmark [ 1 ] = 0 ;
}
if ( c == bestpagebrea )
bestpagebrea = 0 ;
if ( eqtb [ 4577 ] .hh .v.RH != 0 )
{
{
if ( interaction == 3 )
wakeuptermin () ;
printnl ( 133 ) ;
print ( 206 ) ;
}
printesc ( 274 ) ;
print ( 851 ) ;
{
helpptr = 2 ;
helpline [ 1 ] = 852 ;
helpline [ 0 ] = 840 ;
}
boxerror ( 255 ) ;
}
insertpenalt = 0 ;
savesplittop = eqtb [ 3536 ] .hh .v.RH ;
r = mem [(long) memtop ] .hh .v.RH ;
while ( r != memtop ) {
if ( mem [(long) r + 2 ] .hh .v.LH != 0 )
{
n = mem [(long) r ] .hh.b1 ;
ensurevbox ( n ) ;
if ( eqtb [ 4322 + n ] .hh .v.RH == 0 )
eqtb [ 4322 + n ] .hh .v.RH = newnullbox () ;
p = eqtb [ 4322 + n ] .hh .v.RH + 5 ;
while ( mem [(long) p ] .hh .v.RH != 0 ) p = mem [(long) p ] .hh .v.RH ;
mem [(long) r + 2 ] .hh .v.RH = p ;
}
r = mem [(long) r ] .hh .v.RH ;
}
q = memtop - 4 ;
mem [(long) q ] .hh .v.RH = 0 ;
prevp = memtop - 2 ;
p = mem [(long) prevp ] .hh .v.RH ;
while ( p != bestpagebrea ) {
if ( mem [(long) p ] .hh.b0 == 3 )
{
r = mem [(long) memtop ] .hh .v.RH ;
while ( mem [(long) r ] .hh.b1 != mem [(long) p ] .hh.b1 ) r = mem [(long) r ] .hh .v.RH ;
if ( mem [(long) r + 2 ] .hh .v.LH == 0 )
wait = true ;
else {
wait = false ;
s = mem [(long) p + 4 ] .hh .v.LH ;
mem [(long) mem [(long) r + 2 ] .hh .v.RH ] .hh .v.RH = s ;
s = mem [(long) r + 2 ] .hh .v.RH ;
if ( mem [(long) r + 2 ] .hh .v.LH == p )
{
if ( mem [(long) r ] .hh.b0 == 1 )
if ( ( mem [(long) r + 1 ] .hh .v.LH == p ) && ( mem [(long) r + 1 ] .hh .v.RH
!= 0 ) )
{
while ( mem [(long) s ] .hh .v.RH != mem [(long) r + 1 ] .hh .v.RH ) s = mem [(long)
s ] .hh .v.RH ;
eqtb [ 3536 ] .hh .v.RH = mem [(long) p + 4 ] .hh .v.RH ;
mem [(long) p + 4 ] .hh .v.LH = prunepagetop ( mem [(long) r + 1 ] .hh .v.RH )
;
if ( mem [(long) p + 4 ] .hh .v.LH != 0 )
{
tempptr = vpackage ( mem [(long) p + 4 ] .hh .v.LH , 0 , 1 ,
1073741823 ) ;
mem [(long) p + 3 ] .cint = mem [(long) tempptr + 3 ] .cint + mem [(long) tempptr
+ 2 ] .cint ;
freenode ( tempptr , 7 ) ;
wait = true ;
}
mem [(long) s ] .hh .v.RH = 0 ;
}
mem [(long) r + 2 ] .hh .v.LH = 0 ;
n = mem [(long) r ] .hh.b1 ;
tempptr = mem [(long) eqtb [ 4322 + n ] .hh .v.RH + 5 ] .hh .v.RH ;
freenode ( eqtb [ 4322 + n ] .hh .v.RH , 7 ) ;
eqtb [ 4322 + n ] .hh .v.RH = vpackage ( tempptr , 0 , 1 ,
1073741823 ) ;
}
else {
while ( mem [(long) s ] .hh .v.RH != 0 ) s = mem [(long) s ] .hh .v.RH ;
mem [(long) r + 2 ] .hh .v.RH = s ;
}
}
mem [(long) prevp ] .hh .v.RH = mem [(long) p ] .hh .v.RH ;
mem [(long) p ] .hh .v.RH = 0 ;
if ( wait )
{
mem [(long) q ] .hh .v.RH = p ;
q = p ;
incr ( insertpenalt ) ;
}
else {
deletegluere ( mem [(long) p + 4 ] .hh .v.RH ) ;
freenode ( p , 5 ) ;
}
p = prevp ;
}
else if ( mem [(long) p ] .hh.b0 == 4 )
{
if ( curmark [ 1 ] == 0 )
{
curmark [ 1 ] = mem [(long) p + 1 ] .cint ;
incr ( mem [(long) curmark [ 1 ] ] .hh .v.LH ) ;
}
if ( curmark [ 2 ] != 0 )
deletetokenr ( curmark [ 2 ] ) ;
curmark [ 2 ] = mem [(long) p + 1 ] .cint ;
incr ( mem [(long) curmark [ 2 ] ] .hh .v.LH ) ;
}
prevp = p ;
p = mem [(long) prevp ] .hh .v.RH ;
}
eqtb [ 3536 ] .hh .v.RH = savesplittop ;
if ( p != 0 )
{
if ( mem [(long) memtop - 1 ] .hh .v.RH == 0 )
if ( nestptr == 0 )
curlist .tailfield = pagetail ;
else nest [ 0 ] .tailfield = pagetail ;
mem [(long) pagetail ] .hh .v.RH = mem [(long) memtop - 1 ] .hh .v.RH ;
mem [(long) memtop - 1 ] .hh .v.RH = p ;
mem [(long) prevp ] .hh .v.RH = 0 ;
}
savevbadness = eqtb [ 5294 ] .cint ;
eqtb [ 5294 ] .cint = 10000 ;
savevfuzz = eqtb [ 5710 ] .cint ;
eqtb [ 5710 ] .cint = 1073741823 ;
eqtb [ 4577 ] .hh .v.RH = vpackage ( mem [(long) memtop - 2 ] .hh .v.RH , bestsize
, 0 , pagemaxdepth ) ;
eqtb [ 5294 ] .cint = savevbadness ;
eqtb [ 5710 ] .cint = savevfuzz ;
if ( lastglue != 65535L )
deletegluere ( lastglue ) ;
pagecontents = 0 ;
pagetail = memtop - 2 ;
mem [(long) memtop - 2 ] .hh .v.RH = 0 ;
lastglue = 65535L ;
lastpenalty = 0 ;
lastkern = 0 ;
pagesofar [ 7 ] = 0 ;
pagemaxdepth = 0 ;
if ( q != memtop - 4 )
{
mem [(long) memtop - 2 ] .hh .v.RH = mem [(long) memtop - 4 ] .hh .v.RH ;
pagetail = q ;
}
r = mem [(long) memtop ] .hh .v.RH ;
while ( r != memtop ) {
q = mem [(long) r ] .hh .v.RH ;
freenode ( r , 4 ) ;
r = q ;
}
mem [(long) memtop ] .hh .v.RH = memtop ;
if ( ( curmark [ 0 ] != 0 ) && ( curmark [ 1 ] == 0 ) )
{
curmark [ 1 ] = curmark [ 0 ] ;
incr ( mem [(long) curmark [ 0 ] ] .hh .v.LH ) ;
}
if ( eqtb [ 4057 ] .hh .v.RH != 0 )
if ( deadcycles >= eqtb [ 5307 ] .cint )
{
{
if ( interaction == 3 )
wakeuptermin () ;
printnl ( 133 ) ;
print ( 853 ) ;
}
printint ( deadcycles ) ;
print ( 854 ) ;
{
helpptr = 3 ;
helpline [ 2 ] = 855 ;
helpline [ 1 ] = 856 ;
helpline [ 0 ] = 857 ;
}
error () ;
}
else {
outputactive = true ;
incr ( deadcycles ) ;
pushnest () ;
curlist .modefield = - 1 ;
curlist .auxfield = - 65536000 ;
curlist .mlfield = - line ;
begintokenli ( eqtb [ 4057 ] .hh .v.RH , 6 ) ;
newsavelevel ( 8 ) ;
normalparagr () ;
scanleftbrac () ;
return ;
}
{
if ( mem [(long) memtop - 2 ] .hh .v.RH != 0 )
{
if ( mem [(long) memtop - 1 ] .hh .v.RH == 0 )
if ( nestptr == 0 )
curlist .tailfield = pagetail ;
else nest [ 0 ] .tailfield = pagetail ;
else mem [(long) pagetail ] .hh .v.RH = mem [(long) memtop - 1 ] .hh .v.RH ;
mem [(long) memtop - 1 ] .hh .v.RH = mem [(long) memtop - 2 ] .hh .v.RH ;
mem [(long) memtop - 2 ] .hh .v.RH = 0 ;
pagetail = memtop - 2 ;
}
shipout ( eqtb [ 4577 ] .hh .v.RH ) ;
eqtb [ 4577 ] .hh .v.RH = 0 ;
}
}
buildpage () { /* 10 30 31 22 80 90 */ r_buildpage
halfword p ;
halfword q, r ;
integer b, c ;
integer pi ;
quarterword n ;
scaled delta, h, w ;
if ( ( mem [(long) memtop - 1 ] .hh .v.RH == 0 ) || outputactive )
return ;
do { lab22: p = mem [(long) memtop - 1 ] .hh .v.RH ;
if ( lastglue != 65535L )
deletegluere ( lastglue ) ;
lastpenalty = 0 ;
lastkern = 0 ;
if ( mem [(long) p ] .hh.b0 == 10 )
{
lastglue = mem [(long) p + 1 ] .hh .v.LH ;
incr ( mem [(long) lastglue ] .hh .v.RH ) ;
}
else {
lastglue = 65535L ;
if ( mem [(long) p ] .hh.b0 == 12 )
lastpenalty = mem [(long) p + 1 ] .cint ;
else if ( mem [(long) p ] .hh.b0 == 11 )
lastkern = mem [(long) p + 1 ] .cint ;
}
switch ( mem [(long) p ] .hh.b0 )
{case 0 :
case 1 :
case 2 :
if ( pagecontents < 2 )
{
if ( pagecontents == 0 )
freezepagesp ( 2 ) ;
else pagecontents = 2 ;
q = newskipparam ( 9 ) ;
mem [(long) q ] .hh .v.RH = p ;
if ( mem [(long) tempptr + 1 ] .cint > mem [(long) p + 3 ] .cint )
mem [(long) tempptr + 1 ] .cint = mem [(long) tempptr + 1 ] .cint - mem [(long) p + 3 ]
.cint ;
else mem [(long) tempptr + 1 ] .cint = 0 ;
mem [(long) q ] .hh .v.RH = p ;
mem [(long) memtop - 1 ] .hh .v.RH = q ;
goto lab22 ;
}
else {
pagesofar [ 1 ] = pagesofar [ 1 ] + pagesofar [ 7 ] + mem [(long) p + 3 ]
.cint ;
pagesofar [ 7 ] = mem [(long) p + 2 ] .cint ;
goto lab80 ;
}
break ;
case 8 :
goto lab80 ;
break ;
case 10 :
if ( pagecontents < 2 )
goto lab31 ;
else if ( ( mem [(long) pagetail ] .hh.b0 < 9 ) )
pi = 0 ;
else goto lab90 ;
break ;
case 11 :
if ( pagecontents < 2 )
goto lab31 ;
else if ( mem [(long) p ] .hh .v.RH == 0 )
return ;
else if ( mem [(long) mem [(long) p ] .hh .v.RH ] .hh.b0 == 10 )
pi = 0 ;
else goto lab90 ;
break ;
case 12 :
if ( pagecontents < 2 )
goto lab31 ;
else pi = mem [(long) p + 1 ] .cint ;
break ;
case 4 :
goto lab80 ;
break ;
case 3 :
{
if ( pagecontents == 0 )
freezepagesp ( 1 ) ;
n = mem [(long) p ] .hh.b1 ;
r = memtop ;
while ( n >= mem [(long) mem [(long) r ] .hh .v.RH ] .hh.b1 ) r = mem [(long) r ] .hh
.v.RH ;
n = n ;
if ( mem [(long) r ] .hh.b1 != n )
{
q = getnode ( 4 ) ;
mem [(long) q ] .hh .v.RH = mem [(long) r ] .hh .v.RH ;
mem [(long) r ] .hh .v.RH = q ;
r = q ;
mem [(long) r ] .hh.b1 = n ;
mem [(long) r ] .hh.b0 = 0 ;
ensurevbox ( n ) ;
if ( eqtb [ 4322 + n ] .hh .v.RH == 0 )
mem [(long) r + 3 ] .cint = 0 ;
else mem [(long) r + 3 ] .cint = mem [(long) eqtb [ 4322 + n ] .hh .v.RH + 3 ]
.cint + mem [(long) eqtb [ 4322 + n ] .hh .v.RH + 2 ] .cint ;
mem [(long) r + 2 ] .hh .v.LH = 0 ;
q = eqtb [ 3544 + n ] .hh .v.RH ;
if ( eqtb [ 5317 + n ] .cint == 1000 )
h = mem [(long) r + 3 ] .cint ;
else h = xovern ( mem [(long) r + 3 ] .cint , 1000 ) * eqtb [ 5317 + n ]
.cint ;
pagesofar [ 0 ] = pagesofar [ 0 ] - h - mem [(long) q + 1 ] .cint ;
pagesofar [ 2 + mem [(long) q ] .hh.b0 ] = pagesofar [ 2 + mem [(long) q ]
.hh.b0 ] + mem [(long) q + 2 ] .cint ;
pagesofar [ 6 ] = pagesofar [ 6 ] + mem [(long) q + 3 ] .cint ;
if ( ( mem [(long) q ] .hh.b1 != 0 ) && ( mem [(long) q + 3 ] .cint != 0 ) )
{
{
if ( interaction == 3 )
wakeuptermin () ;
printnl ( 133 ) ;
print ( 846 ) ;
}
printesc ( 260 ) ;
printint ( n ) ;
{
helpptr = 3 ;
helpline [ 2 ] = 847 ;
helpline [ 1 ] = 848 ;
helpline [ 0 ] = 776 ;
}
error () ;
}
}
if ( mem [(long) r ] .hh.b0 == 1 )
insertpenalt = insertpenalt + mem [(long) p + 1 ] .cint ;
else {
mem [(long) r + 2 ] .hh .v.RH = p ;
delta = pagesofar [ 0 ] - pagesofar [ 1 ] - pagesofar [ 7 ] +
pagesofar [ 6 ] ;
if ( eqtb [ 5317 + n ] .cint == 1000 )
h = mem [(long) p + 3 ] .cint ;
else h = xovern ( mem [(long) p + 3 ] .cint , 1000 ) * eqtb [ 5317 + n ]
.cint ;
if ( ( ( h <= 0 ) || ( h <= delta ) ) && ( mem [(long) p + 3 ] .cint + mem
[ r + 3 ] .cint <= eqtb [ 5721 + n ] .cint ) )
{
pagesofar [ 0 ] = pagesofar [ 0 ] - h ;
mem [(long) r + 3 ] .cint = mem [(long) r + 3 ] .cint + mem [(long) p + 3 ] .cint ;
}
else {
if ( eqtb [ 5317 + n ] .cint <= 0 )
w = 1073741823 ;
else {
w = pagesofar [ 0 ] - pagesofar [ 1 ] - pagesofar [ 7 ] ;
if ( eqtb [ 5317 + n ] .cint != 1000 )
w = xovern ( w , eqtb [ 5317 + n ] .cint ) * 1000 ;
}
if ( w > eqtb [ 5721 + n ] .cint - mem [(long) r + 3 ] .cint )
w = eqtb [ 5721 + n ] .cint - mem [(long) r + 3 ] .cint ;
q = vertbreak ( mem [(long) p + 4 ] .hh .v.LH , w , mem [(long) p + 2 ] .cint
) ;
mem [(long) r + 3 ] .cint = mem [(long) r + 3 ] .cint + bestheightpl ;
#ifdef STAT
if ( eqtb [ 5300 ] .cint > 0 )
{
begindiagnos () ;
printnl ( 849 ) ;
printint ( n ) ;
print ( 850 ) ;
printscaled ( w ) ;
printchar ( 44 ) ;
printscaled ( bestheightpl ) ;
print ( 785 ) ;
if ( q == 0 )
printint ( - 10000 ) ;
else if ( mem [(long) q ] .hh.b0 == 12 )
printint ( mem [(long) q + 1 ] .cint ) ;
else printchar ( 48 ) ;
enddiagnosti ( false ) ;
}
#endif /* STAT */
if ( eqtb [ 5317 + n ] .cint != 1000 )
bestheightpl = xovern ( bestheightpl , 1000 ) * eqtb [ 5317 + n ]
.cint ;
pagesofar [ 0 ] = pagesofar [ 0 ] - bestheightpl ;
mem [(long) r ] .hh.b0 = 1 ;
mem [(long) r + 1 ] .hh .v.RH = q ;
mem [(long) r + 1 ] .hh .v.LH = p ;
if ( q == 0 )
insertpenalt = insertpenalt - 10000 ;
else if ( mem [(long) q ] .hh.b0 == 12 )
insertpenalt = insertpenalt + mem [(long) q + 1 ] .cint ;
}
}
goto lab80 ;
}
break ;
default :
confusion ( 841 ) ;
break ;
}
if ( pi < 10000 )
{
if ( pagesofar [ 1 ] < pagesofar [ 0 ] )
if ( ( pagesofar [ 3 ] != 0 ) || ( pagesofar [ 4 ] != 0 ) || ( pagesofar
[ 5 ] != 0 ) )
b = 0 ;
else b = badness ( pagesofar [ 0 ] - pagesofar [ 1 ] , pagesofar [ 2 ] )
;
else if ( pagesofar [ 1 ] - pagesofar [ 0 ] > pagesofar [ 6 ] )
b = 1073741823 ;
else b = badness ( pagesofar [ 1 ] - pagesofar [ 0 ] , pagesofar [ 6 ] )
;
if ( b < 1073741823 )
if ( pi <= - 10000 )
c = pi ;
else if ( b < 10000 )
c = b + pi + insertpenalt ;
else c = 100000 ;
else c = b ;
if ( insertpenalt >= 10000 )
c = 1073741823 ;
#ifdef STAT
if ( eqtb [ 5300 ] .cint > 0 )
{
begindiagnos () ;
printnl ( 37 ) ;
print ( 781 ) ;
printtotals () ;
print ( 844 ) ;
printscaled ( pagesofar [ 0 ] ) ;
print ( 784 ) ;
if ( b == 1073741823 )
printchar ( 42 ) ;
else printint ( b ) ;
print ( 785 ) ;
printint ( pi ) ;
print ( 845 ) ;
if ( c == 1073741823 )
printchar ( 42 ) ;
else printint ( c ) ;
if ( c <= leastpagecos )
printchar ( 35 ) ;
enddiagnosti ( false ) ;
}
#endif /* STAT */
if ( c <= leastpagecos )
{
bestpagebrea = p ;
bestsize = pagesofar [ 0 ] ;
leastpagecos = c ;
r = mem [(long) memtop ] .hh .v.RH ;
while ( r != memtop ) {
mem [(long) r + 2 ] .hh .v.LH = mem [(long) r + 2 ] .hh .v.RH ;
r = mem [(long) r ] .hh .v.RH ;
}
}
if ( ( c == 1073741823 ) || ( pi <= - 10000 ) )
{
fireup ( p ) ;
if ( outputactive )
return ;
goto lab30 ;
}
}
if ( ( mem [(long) p ] .hh.b0 < 10 ) || ( mem [(long) p ] .hh.b0 > 11 ) )
goto lab80 ;
lab90: if ( mem [(long) p ] .hh.b0 == 11 )
q = p ;
else {
q = mem [(long) p + 1 ] .hh .v.LH ;
pagesofar [ 2 + mem [(long) q ] .hh.b0 ] = pagesofar [ 2 + mem [(long) q ] .hh.b0 ]
+ mem [(long) q + 2 ] .cint ;
pagesofar [ 6 ] = pagesofar [ 6 ] + mem [(long) q + 3 ] .cint ;
if ( ( mem [(long) q ] .hh.b1 != 0 ) && ( mem [(long) q + 3 ] .cint != 0 ) )
{
{
if ( interaction == 3 )
wakeuptermin () ;
printnl ( 133 ) ;
print ( 842 ) ;
}
{
helpptr = 4 ;
helpline [ 3 ] = 843 ;
helpline [ 2 ] = 811 ;
helpline [ 1 ] = 812 ;
helpline [ 0 ] = 776 ;
}
error () ;
r = newspec ( q ) ;
mem [(long) r ] .hh.b1 = 0 ;
deletegluere ( q ) ;
mem [(long) p + 1 ] .hh .v.LH = r ;
}
}
pagesofar [ 1 ] = pagesofar [ 1 ] + pagesofar [ 7 ] + mem [(long) q + 1 ] .cint
;
pagesofar [ 7 ] = 0 ;
lab80: if ( pagesofar [ 7 ] > pagemaxdepth )
{
pagesofar [ 1 ] = pagesofar [ 1 ] + pagesofar [ 7 ] - pagemaxdepth ;
pagesofar [ 7 ] = pagemaxdepth ;
}
mem [(long) pagetail ] .hh .v.RH = p ;
pagetail = p ;
mem [(long) memtop - 1 ] .hh .v.RH = mem [(long) p ] .hh .v.RH ;
mem [(long) p ] .hh .v.RH = 0 ;
goto lab30 ;
lab31: mem [(long) memtop - 1 ] .hh .v.RH = mem [(long) p ] .hh .v.RH ;
mem [(long) p ] .hh .v.RH = 0 ;
flushnodelis ( p ) ;
lab30: ;
} while ( ! ( mem [(long) memtop - 1 ] .hh .v.RH == 0 ) ) ;
if ( nestptr == 0 )
curlist .tailfield = memtop - 1 ;
else nest [ 0 ] .tailfield = memtop - 1 ;
}
appspace () { r_appspace
halfword p ;
halfword q ;
internalfont f ;
integer k ;
if ( ( curlist .auxfield >= 2000 ) && ( eqtb [ 3539 ] .hh .v.RH != 0 ) )
q = newparamglue ( 13 ) ;
else {
if ( eqtb [ 3538 ] .hh .v.RH != 0 )
p = eqtb [ 3538 ] .hh .v.RH ;
else {
p = fontglue [ eqtb [ 4578 ] .hh .v.RH ] ;
if ( p == 0 )
{
f = eqtb [ 4578 ] .hh .v.RH ;
p = newspec ( 0 ) ;
k = parambase [ f ] + 2 ;
mem [(long) p + 1 ] .cint = fontinfo [ k ] .cint ;
mem [(long) p + 2 ] .cint = fontinfo [ k + 1 ] .cint ;
mem [(long) p + 3 ] .cint = fontinfo [ k + 2 ] .cint ;
fontglue [ f ] = p ;
}
}
p = newspec ( p ) ;
if ( curlist .auxfield >= 2000 )
mem [(long) p + 1 ] .cint = mem [(long) p + 1 ] .cint + fontinfo [ 7 + parambase [
eqtb [ 4578 ] .hh .v.RH ] ] .cint ;
mem [(long) p + 2 ] .cint = xnoverd ( mem [(long) p + 2 ] .cint , curlist .auxfield ,
1000 ) ;
mem [(long) p + 3 ] .cint = xnoverd ( mem [(long) p + 3 ] .cint , 1000 , curlist
.auxfield ) ;
q = newglue ( p ) ;
mem [(long) p ] .hh .v.RH = 0 ;
}
mem [(long) curlist .tailfield ] .hh .v.RH = q ;
curlist .tailfield = q ;
}
insertdollar () { r_insertdollar
backinput () ;
curtok = 804 ;
{
if ( interaction == 3 )
wakeuptermin () ;
printnl ( 133 ) ;
print ( 865 ) ;
}
{
helpptr = 2 ;
helpline [ 1 ] = 866 ;
helpline [ 0 ] = 867 ;
}
inserror () ;
}
youcant () { r_youcant
{
if ( interaction == 3 )
wakeuptermin () ;
printnl ( 133 ) ;
print ( 541 ) ;
}
printcmdchr ( curcmd , curchr ) ;
print ( 868 ) ;
printmode ( curlist .modefield ) ;
}
reportillega () { r_reportillega
youcant () ;
{
helpptr = 4 ;
helpline [ 3 ] = 869 ;
helpline [ 2 ] = 870 ;
helpline [ 1 ] = 871 ;
helpline [ 0 ] = 872 ;
}
error () ;
}
boolean privileged () { register boolean Result; r_privileged
if ( curlist .modefield > 0 )
Result = true ;
else {
reportillega () ;
Result = false ;
}
return(Result) ;
}
boolean itsallover () { /* 10 */ register boolean Result; r_itsallover
if ( privileged () )
{
if ( ( memtop - 2 == pagetail ) && ( curlist .headfield == curlist
.tailfield ) && ( deadcycles == 0 ) )
{
Result = true ;
return(Result) ;
}
backinput () ;
{
mem [(long) curlist .tailfield ] .hh .v.RH = newnullbox () ;
curlist .tailfield = mem [(long) curlist .tailfield ] .hh .v.RH ;
}
mem [(long) curlist .tailfield + 1 ] .cint = eqtb [ 5704 ] .cint ;
{
mem [(long) curlist .tailfield ] .hh .v.RH = newglue ( 8 ) ;
curlist .tailfield = mem [(long) curlist .tailfield ] .hh .v.RH ;
}
{
mem [(long) curlist .tailfield ] .hh .v.RH = newpenalty ( - 1073741824 ) ;
curlist .tailfield = mem [(long) curlist .tailfield ] .hh .v.RH ;
}
buildpage () ;
}
Result = false ;
return(Result) ;
}
appendglue () { r_appendglue
smallnumber s ;
s = curchr ;
switch ( s )
{case 0 :
curval = 4 ;
break ;
case 1 :
curval = 8 ;
break ;
case 2 :
curval = 12 ;
break ;
case 3 :
curval = 16 ;
break ;
case 4 :
scanglue ( 2 ) ;
break ;
case 5 :
scanglue ( 3 ) ;
break ;
}
{
mem [(long) curlist .tailfield ] .hh .v.RH = newglue ( curval ) ;
curlist .tailfield = mem [(long) curlist .tailfield ] .hh .v.RH ;
}
if ( s >= 4 )
{
decr ( mem [(long) curval ] .hh .v.RH ) ;
if ( s > 4 )
mem [(long) curlist .tailfield ] .hh.b1 = 99 ;
}
}
appendkern () { r_appendkern
quarterword s ;
s = curchr ;
scandimen ( s == 99 , false , false ) ;
{
mem [(long) curlist .tailfield ] .hh .v.RH = newkern ( curval ) ;
curlist .tailfield = mem [(long) curlist .tailfield ] .hh .v.RH ;
}
mem [(long) curlist .tailfield ] .hh.b1 = s ;
}
offsave () { r_offsave
halfword p ;
if ( curgroup == 0 )
{
{
if ( interaction == 3 )
wakeuptermin () ;
printnl ( 133 ) ;
print ( 633 ) ;
}
printcmdchr ( curcmd , curchr ) ;
{
helpptr = 1 ;
helpline [ 0 ] = 891 ;
}
error () ;
}
else {
backinput () ;
p = getavail () ;
mem [(long) memtop - 3 ] .hh .v.RH = p ;
{
if ( interaction == 3 )
wakeuptermin () ;
printnl ( 133 ) ;
print ( 483 ) ;
}
switch ( curgroup )
{case 14 :
{
mem [(long) p ] .hh .v.LH = 7356 ;
printesc ( 375 ) ;
}
break ;
case 15 :
{
mem [(long) p ] .hh .v.LH = 804 ;
printchar ( 36 ) ;
}
break ;
case 16 :
{
mem [(long) p ] .hh .v.LH = 7357 ;
mem [(long) p ] .hh .v.RH = getavail () ;
p = mem [(long) p ] .hh .v.RH ;
mem [(long) p ] .hh .v.LH = 3118 ;
printesc ( 890 ) ;
}
break ;
default :
{
mem [(long) p ] .hh .v.LH = 637 ;
printchar ( 125 ) ;
}
break ;
}
print ( 484 ) ;
begintokenli ( mem [(long) memtop - 3 ] .hh .v.RH , 4 ) ;
{
helpptr = 5 ;
helpline [ 4 ] = 885 ;
helpline [ 3 ] = 886 ;
helpline [ 2 ] = 887 ;
helpline [ 1 ] = 888 ;
helpline [ 0 ] = 889 ;
}
error () ;
}
}
extrarightbr () { r_extrarightbr
{
if ( interaction == 3 )
wakeuptermin () ;
printnl ( 133 ) ;
print ( 896 ) ;
}
switch ( curgroup )
{case 14 :
printesc ( 375 ) ;
break ;
case 15 :
printchar ( 36 ) ;
break ;
case 16 :
printesc ( 730 ) ;
break ;
}
{
helpptr = 5 ;
helpline [ 4 ] = 897 ;
helpline [ 3 ] = 898 ;
helpline [ 2 ] = 899 ;
helpline [ 1 ] = 900 ;
helpline [ 0 ] = 901 ;
}
error () ;
incr ( alignstate ) ;
}
normalparagr () { r_normalparagr
if ( eqtb [ 5286 ] .cint != 0 )
eqworddefine ( 5286 , 0 ) ;
if ( eqtb [ 5718 ] .cint != 0 )
eqworddefine ( 5718 , 0 ) ;
if ( eqtb [ 5308 ] .cint != 1 )
eqworddefine ( 5308 , 1 ) ;
if ( eqtb [ 4056 ] .hh .v.RH != 0 )
eqdefine ( 4056 , 117 , 0 ) ;
}
boxend () { r_boxend
halfword p ;
if ( savestack [ saveptr + 0 ] .cint < 1073741824 )
{
if ( curbox != 0 )
{
mem [(long) curbox + 4 ] .cint = savestack [ saveptr + 0 ] .cint ;
if ( abs ( curlist .modefield ) == 1 )
{
appendtovlis ( curbox ) ;
if ( adjusttail != 0 )
{
if ( memtop - 5 != adjusttail )
{
mem [(long) curlist .tailfield ] .hh .v.RH = mem [(long) memtop - 5 ] .hh
.v.RH ;
curlist .tailfield = adjusttail ;
}
adjusttail = 0 ;
}
if ( curlist .modefield > 0 )
buildpage () ;
}
else {
if ( abs ( curlist .modefield ) == 101 )
curlist .auxfield = 1000 ;
else {
p = newnoad () ;
mem [(long) p + 1 ] .hh .v.RH = 2 ;
mem [(long) p + 1 ] .hh .v.LH = curbox ;
curbox = p ;
}
mem [(long) curlist .tailfield ] .hh .v.RH = curbox ;
curlist .tailfield = curbox ;
}
}
}
else if ( savestack [ saveptr + 0 ] .cint < 1073742336 )
if ( savestack [ saveptr + 0 ] .cint < 1073742080 )
eqdefine ( - 1073737502 + savestack [ saveptr + 0 ] .cint , 118 , curbox ) ;
else geqdefine ( - 1073737758 + savestack [ saveptr + 0 ] .cint , 118 ,
curbox ) ;
else if ( curbox != 0 )
if ( savestack [ saveptr + 0 ] .cint > 1073742336 )
{
do { getxtoken () ;
} while ( ! ( ( curcmd != 10 ) && ( curcmd != 0 ) ) ) ;
if ( ( ( curcmd == 26 ) && ( abs ( curlist .modefield ) != 1 ) ) || ( (
curcmd == 27 ) && ( abs ( curlist .modefield ) == 1 ) ) || ( ( curcmd ==
28 ) && ( abs ( curlist .modefield ) == 201 ) ) )
{
appendglue () ;
mem [(long) curlist .tailfield ] .hh.b1 = savestack [ saveptr + 0 ] .cint - (
1073742237 ) ;
mem [(long) curlist .tailfield + 1 ] .hh .v.RH = curbox ;
}
else {
{
if ( interaction == 3 )
wakeuptermin () ;
printnl ( 133 ) ;
print ( 914 ) ;
}
{
helpptr = 3 ;
helpline [ 2 ] = 915 ;
helpline [ 1 ] = 916 ;
helpline [ 0 ] = 917 ;
}
backerror () ;
flushnodelis ( curbox ) ;
}
}
else shipout ( curbox ) ;
}
beginbox () { /* 10 30 */ r_beginbox
halfword p, q ;
quarterword m ;
halfword k ;
eightbits n ;
switch ( curchr )
{case 0 :
{
scaneightbit () ;
curbox = eqtb [ 4322 + curval ] .hh .v.RH ;
eqtb [ 4322 + curval ] .hh .v.RH = 0 ;
}
break ;
case 1 :
{
scaneightbit () ;
curbox = copynodelist ( eqtb [ 4322 + curval ] .hh .v.RH ) ;
}
break ;
case 2 :
{
curbox = 0 ;
if ( abs ( curlist .modefield ) == 201 )
{
youcant () ;
{
helpptr = 1 ;
helpline [ 0 ] = 918 ;
}
error () ;
}
else if ( ( curlist .modefield == 1 ) && ( curlist .headfield == curlist
.tailfield ) )
{
youcant () ;
{
helpptr = 2 ;
helpline [ 1 ] = 919 ;
helpline [ 0 ] = 920 ;
}
error () ;
}
else {
if ( ! ( curlist .tailfield >= himemmin ) )
if ( ( mem [(long) curlist .tailfield ] .hh.b0 == 0 ) || ( mem [(long) curlist
.tailfield ] .hh.b0 == 1 ) )
{
q = curlist .headfield ;
do { p = q ;
if ( ! ( q >= himemmin ) )
if ( mem [(long) q ] .hh.b0 == 7 )
{
for ( m = 1 ; m <= mem [(long) q ] .hh.b1 ; m ++ )
p = mem [(long) p ] .hh .v.RH ;
if ( p == curlist .tailfield )
goto lab30 ;
}
q = mem [(long) p ] .hh .v.RH ;
} while ( ! ( q == curlist .tailfield ) ) ;
curbox = curlist .tailfield ;
mem [(long) curbox + 4 ] .cint = 0 ;
curlist .tailfield = p ;
mem [(long) p ] .hh .v.RH = 0 ;
lab30: ;
}
}
}
break ;
case 3 :
{
scaneightbit () ;
n = curval ;
if ( ! scankeyword ( 695 ) )
{
{
if ( interaction == 3 )
wakeuptermin () ;
printnl ( 133 ) ;
print ( 921 ) ;
}
{
helpptr = 2 ;
helpline [ 1 ] = 922 ;
helpline [ 0 ] = 923 ;
}
error () ;
}
scandimen ( false , false , false ) ;
curbox = vsplit ( n , curval ) ;
}
break ;
default :
{
k = curchr - 4 ;
incr ( saveptr ) ;
scanspec () ;
if ( k == 101 )
if ( ( savestack [ saveptr - 3 ] .cint < 1073741824 ) && ( abs ( curlist
.modefield ) == 1 ) )
newsavelevel ( 3 ) ;
else newsavelevel ( 2 ) ;
else {
if ( k == 1 )
newsavelevel ( 4 ) ;
else {
newsavelevel ( 5 ) ;
k = 1 ;
}
normalparagr () ;
}
pushnest () ;
curlist .modefield = - k ;
if ( k == 1 )
{
curlist .auxfield = - 65536000 ;
if ( eqtb [ 4062 ] .hh .v.RH != 0 )
begintokenli ( eqtb [ 4062 ] .hh .v.RH , 11 ) ;
}
else {
curlist .auxfield = 1000 ;
if ( eqtb [ 4061 ] .hh .v.RH != 0 )
begintokenli ( eqtb [ 4061 ] .hh .v.RH , 10 ) ;
}
return ;
}
break ;
}
boxend () ;
}
scanbox () { r_scanbox
do { getxtoken () ;
} while ( ! ( ( curcmd != 10 ) && ( curcmd != 0 ) ) ) ;
if ( curcmd == 20 )
beginbox () ;
else if ( ( savestack [ saveptr + 0 ] .cint >= 1073742337 ) && ( ( curcmd ==
36 ) || ( curcmd == 35 ) ) )
{
curbox = scanrulespec () ;
boxend () ;
}
else {
{
if ( interaction == 3 )
wakeuptermin () ;
printnl ( 133 ) ;
print ( 924 ) ;
}
{
helpptr = 3 ;
helpline [ 2 ] = 925 ;
helpline [ 1 ] = 926 ;
helpline [ 0 ] = 927 ;
}
backerror () ;
}
}
zpackage ( c )
smallnumber c ;
{r_package
scaled h ;
halfword p ;
scaled d ;
d = eqtb [ 5708 ] .cint ;
unsave () ;
saveptr = saveptr - 3 ;
if ( curlist .modefield == - 101 )
curbox = hpack ( mem [(long) curlist .headfield ] .hh .v.RH , savestack [ saveptr
+ 2 ] .cint , savestack [ saveptr + 1 ] .cint ) ;
else {
curbox = vpackage ( mem [(long) curlist .headfield ] .hh .v.RH , savestack [
saveptr + 2 ] .cint , savestack [ saveptr + 1 ] .cint , d ) ;
if ( c == 4 )
{
h = 0 ;
p = mem [(long) curbox + 5 ] .hh .v.RH ;
if ( p != 0 )
if ( mem [(long) p ] .hh.b0 <= 2 )
h = mem [(long) p + 3 ] .cint ;
mem [(long) curbox + 2 ] .cint = mem [(long) curbox + 2 ] .cint - h + mem [(long) curbox +
3 ] .cint ;
mem [(long) curbox + 3 ] .cint = h ;
}
}
popnest () ;
boxend () ;
}
znewgraf ( indented )
boolean indented ;
{r_newgraf
curlist .pgfield = 0 ;
if ( ( curlist .modefield == 1 ) || ( curlist .headfield != curlist
.tailfield ) )
{
mem [(long) curlist .tailfield ] .hh .v.RH = newparamglue ( 2 ) ;
curlist .tailfield = mem [(long) curlist .tailfield ] .hh .v.RH ;
}
pushnest () ;
curlist .modefield = 101 ;
curlist .auxfield = 1000 ;
if ( indented )
{
curlist .tailfield = newnullbox () ;
mem [(long) curlist .headfield ] .hh .v.RH = curlist .tailfield ;
mem [(long) curlist .tailfield + 1 ] .cint = eqtb [ 5701 ] .cint ;
}
if ( eqtb [ 4058 ] .hh .v.RH != 0 )
begintokenli ( eqtb [ 4058 ] .hh .v.RH , 7 ) ;
if ( nestptr == 1 )
buildpage () ;
}
indentinhmod () { r_indentinhmod
halfword p, q ;
if ( curchr > 0 )
{
p = newnullbox () ;
mem [(long) p + 1 ] .cint = eqtb [ 5701 ] .cint ;
if ( abs ( curlist .modefield ) == 101 )
curlist .auxfield = 1000 ;
else {
q = newnoad () ;
mem [(long) q + 1 ] .hh .v.RH = 2 ;
mem [(long) q + 1 ] .hh .v.LH = p ;
p = q ;
}
{
mem [(long) curlist .tailfield ] .hh .v.RH = p ;
curlist .tailfield = mem [(long) curlist .tailfield ] .hh .v.RH ;
}
}
}
headforvmode () { r_headforvmode
if ( curlist .modefield < 0 )
if ( curcmd != 36 )
offsave () ;
else {
{
if ( interaction == 3 )
wakeuptermin () ;
printnl ( 133 ) ;
print ( 541 ) ;
}
printesc ( 380 ) ;
print ( 930 ) ;
{
helpptr = 2 ;
helpline [ 1 ] = 931 ;
helpline [ 0 ] = 932 ;
}
error () ;
}
else {
backinput () ;
curtok = partoken ;
backinput () ;
curinput .indexfield = 4 ;
}
}
endgraf () { r_endgraf
if ( curlist .modefield == 101 )
{
if ( curlist .headfield == curlist .tailfield )
popnest () ;
else linebreak ( eqtb [ 5273 ] .cint ) ;
normalparagr () ;
errorcount = 0 ;
}
}
begininserto () { r_begininserto
if ( curcmd == 38 )
curval = 255 ;
else {
scaneightbit () ;
if ( curval == 255 )
{
{
if ( interaction == 3 )
wakeuptermin () ;
printnl ( 133 ) ;
print ( 933 ) ;
}
printesc ( 198 ) ;
printint ( 255 ) ;
{
helpptr = 1 ;
helpline [ 0 ] = 934 ;
}
error () ;
curval = 0 ;
}
}
savestack [ saveptr + 0 ] .cint = curval ;
incr ( saveptr ) ;
newsavelevel ( 11 ) ;
scanleftbrac () ;
normalparagr () ;
pushnest () ;
curlist .modefield = - 1 ;
curlist .auxfield = - 65536000 ;
}
makemark () { r_makemark
halfword p ;
p = scantoks ( false , true ) ;
p = getnode ( 2 ) ;
mem [(long) p ] .hh.b0 = 4 ;
mem [(long) p ] .hh.b1 = 0 ;
mem [(long) p + 1 ] .cint = defref ;
mem [(long) curlist .tailfield ] .hh .v.RH = p ;
curlist .tailfield = p ;
}
appendpenalt () { r_appendpenalt
scanint () ;
{
mem [(long) curlist .tailfield ] .hh .v.RH = newpenalty ( curval ) ;
curlist .tailfield = mem [(long) curlist .tailfield ] .hh .v.RH ;
}
if ( curlist .modefield == 1 )
buildpage () ;
}
deletelast () { /* 10 */ r_deletelast
halfword p, q ;
quarterword m ;
if ( ( curlist .modefield == 1 ) && ( curlist .tailfield == curlist
.headfield ) )
{
if ( ( curchr != 10 ) || ( lastglue != 65535L ) )
{
youcant () ;
{
helpptr = 2 ;
helpline [ 1 ] = 919 ;
helpline [ 0 ] = 935 ;
}
if ( curchr == 11 )
helpline [ 0 ] = ( 936 ) ;
else if ( curchr != 10 )
helpline [ 0 ] = ( 937 ) ;
error () ;
}
}
else {
if ( ! ( curlist .tailfield >= himemmin ) )
if ( mem [(long) curlist .tailfield ] .hh.b0 == curchr )
{
q = curlist .headfield ;
do { p = q ;
if ( ! ( q >= himemmin ) )
if ( mem [(long) q ] .hh.b0 == 7 )
{
for ( m = 1 ; m <= mem [(long) q ] .hh.b1 ; m ++ )
p = mem [(long) p ] .hh .v.RH ;
if ( p == curlist .tailfield )
return ;
}
q = mem [(long) p ] .hh .v.RH ;
} while ( ! ( q == curlist .tailfield ) ) ;
mem [(long) p ] .hh .v.RH = 0 ;
flushnodelis ( curlist .tailfield ) ;
curlist .tailfield = p ;
}
}
}
unpackage () { /* 10 */ r_unpackage
halfword p ;
quarterword c ;
c = curchr ;
scaneightbit () ;
p = eqtb [ 4322 + curval ] .hh .v.RH ;
if ( p == 0 )
return ;
if ( ( abs ( curlist .modefield ) == 201 ) || ( ( abs ( curlist .modefield )
== 1 ) && ( mem [(long) p ] .hh.b0 != 1 ) ) || ( ( abs ( curlist .modefield ) ==
101 ) && ( mem [(long) p ] .hh.b0 != 0 ) ) )
{
{
if ( interaction == 3 )
wakeuptermin () ;
printnl ( 133 ) ;
print ( 945 ) ;
}
{
helpptr = 3 ;
helpline [ 2 ] = 946 ;
helpline [ 1 ] = 947 ;
helpline [ 0 ] = 948 ;
}
error () ;
return ;
}
if ( c == 1 )
mem [(long) curlist .tailfield ] .hh .v.RH = copynodelist ( mem [(long) p + 5 ] .hh
.v.RH ) ;
else {
mem [(long) curlist .tailfield ] .hh .v.RH = mem [(long) p + 5 ] .hh .v.RH ;
eqtb [ 4322 + curval ] .hh .v.RH = 0 ;
freenode ( p , 7 ) ;
}
while ( mem [(long) curlist .tailfield ] .hh .v.RH != 0 )
curlist .tailfield = mem [ (long) curlist .tailfield ] .hh .v.RH ;
}
appenditalic () { /* 10 */ r_appenditalic
halfword p ;
internalfont f ;
fourquarters qi;
if ( curlist .tailfield != curlist .headfield )
{
if ( ( curlist .tailfield >= himemmin ) )
p = curlist .tailfield ;
else if ( mem [(long) curlist .tailfield ] .hh.b0 == 6 )
p = curlist .tailfield + 1 ;
else return ;
f = mem [(long) p ] .hh.b0 ;
{
/* mem [(long) curlist .tailfield ] .hh .v.RH = newkern ( fontinfo [ italicbase [
f ] + ( fontinfo [ charbase [ f ] + mem [(long) p ] .hh.b1 ] .qqqq .b2 ) / 4 ]
.cint ) ;
*/
qi = fontinfo [ charbase [ f ] + mem [(long) p ] .hh.b1 ] .qqqq ;
mem [(long) curlist .tailfield ] .hh .v.RH = newkern ( fontinfo [ italicbase [
f ] + ( qi.b2 ) / 4 ] .cint ) ;
curlist .tailfield = mem [(long) curlist .tailfield ] .hh .v.RH ;
}
mem [(long) curlist .tailfield ] .hh.b1 = 1 ;
}
}
appenddiscre () { r_appenddiscre
integer c ;
{
mem [(long) curlist .tailfield ] .hh .v.RH = newdisc () ;
curlist .tailfield = mem [(long) curlist .tailfield ] .hh .v.RH ;
}
if ( curchr == 1 )
{
c = hyphenchar [ eqtb [ 4578 ] .hh .v.RH ] ;
if ( c >= 0 )
if ( c < 256 )
mem [(long) curlist .tailfield + 1 ] .hh .v.LH = newcharacter ( eqtb [ 4578 ]
.hh .v.RH , c ) ;
}
else {
incr ( saveptr ) ;
savestack [ saveptr - 1 ] .cint = 0 ;
scanleftbrac () ;
newsavelevel ( 10 ) ;
pushnest () ;
curlist .modefield = - 101 ;
curlist .auxfield = 1000 ;
}
}
builddiscret () { /* 30 10 */ r_builddiscret
halfword p, q ;
integer n ;
unsave () ;
q = curlist .headfield ;
p = mem [(long) q ] .hh .v.RH ;
n = 0 ;
while ( p != 0 ) {
if ( ! ( p >= himemmin ) )
if ( mem [(long) p ] .hh.b0 > 2 )
if ( mem [(long) p ] .hh.b0 != 11 )
if ( mem [(long) p ] .hh.b0 != 6 )
{
{
if ( interaction == 3 )
wakeuptermin () ;
printnl ( 133 ) ;
print ( 955 ) ;
}
{
helpptr = 1 ;
helpline [ 0 ] = 956 ;
}
error () ;
begindiagnos () ;
printnl ( 957 ) ;
showbox ( p ) ;
enddiagnosti ( true ) ;
flushnodelis ( p ) ;
mem [(long) q ] .hh .v.RH = 0 ;
goto lab30 ;
}
q = p ;
p = mem [(long) q ] .hh .v.RH ;
incr ( n ) ;
}
lab30: ;
p = mem [(long) curlist .headfield ] .hh .v.RH ;
popnest () ;
switch ( savestack [ saveptr - 1 ] .cint )
{case 0 :
mem [(long) curlist .tailfield + 1 ] .hh .v.LH = p ;
break ;
case 1 :
mem [(long) curlist .tailfield + 1 ] .hh .v.RH = p ;
break ;
case 2 :
{
if ( ( n > 0 ) && ( abs ( curlist .modefield ) == 201 ) )
{
{
if ( interaction == 3 )
wakeuptermin () ;
printnl ( 133 ) ;
print ( 949 ) ;
}
printesc ( 217 ) ;
{
helpptr = 2 ;
helpline [ 1 ] = 950 ;
helpline [ 0 ] = 951 ;
}
flushnodelis ( p ) ;
n = 0 ;
error () ;
}
else mem [(long) curlist .tailfield ] .hh .v.RH = p ;
if ( n <= 255 )
mem [(long) curlist .tailfield ] .hh.b1 = n ;
else {
{
if ( interaction == 3 )
wakeuptermin () ;
printnl ( 133 ) ;
print ( 952 ) ;
}
{
helpptr = 2 ;
helpline [ 1 ] = 953 ;
helpline [ 0 ] = 954 ;
}
error () ;
}
if ( n > 0 )
curlist .tailfield = q ;
decr ( saveptr ) ;
return ;
}
break ;
}
incr ( savestack [ saveptr - 1 ] .cint ) ;
scanleftbrac () ;
newsavelevel ( 10 ) ;
pushnest () ;
curlist .modefield = - 101 ;
curlist .auxfield = 1000 ;
}
makeaccent () { r_makeaccent
real s, t ;
halfword p, q, r ;
internalfont f ;
scaled a, h, x, w, delta ;
fourquarters i ;
scancharnum () ;
f = eqtb [ 4578 ] .hh .v.RH ;
p = newcharacter ( f , curval ) ;
if ( p != 0 )
{
x = fontinfo [ 5 + parambase [ f ] ] .cint ;
s = fontinfo [ 1 + parambase [ f ] ] .cint / ((double) 65536.0 ) ;
/* a = fontinfo [ widthbase [ f ] + fontinfo [ charbase [ f ] + mem [(long) p ]
.hh.b1 ] .qqqq .b0 ] .cint ; */
i = fontinfo [ charbase [ f ] + mem [(long) p ] .hh.b1 ] .qqqq ;
a = fontinfo [ widthbase [ f ] + i .b0 ] .cint ;
doassignment () ;
q = 0 ;
f = eqtb [ 4578 ] .hh .v.RH ;
if ( ( curcmd == 11 ) || ( curcmd == 12 ) || ( curcmd == 67 ) )
q = newcharacter ( f , curchr ) ;
else if ( curcmd == 16 )
{
scancharnum () ;
q = newcharacter ( f , curval ) ;
}
else backinput () ;
if ( q != 0 )
{
t = fontinfo [ 1 + parambase [ f ] ] .cint / ((double) 65536.0 ) ;
i = fontinfo [ charbase [ f ] + mem [(long) q ] .hh.b1 ] .qqqq ;
w = fontinfo [ widthbase [ f ] + i .b0 ] .cint ;
h = fontinfo [ heightbase [ f ] + ( i .b1 ) / 16 ] .cint ;
if ( h != x )
{
p = hpack ( p , 0 , 1 ) ;
mem [(long) p + 4 ] .cint = x - h ;
}
delta = round ( ( w - a ) / ((double) 2.0 ) + h * t - x * s ) ;
r = newkern ( delta ) ;
mem [(long) r ] .hh.b1 = 2 ;
mem [(long) curlist .tailfield ] .hh .v.RH = r ;
mem [(long) r ] .hh .v.RH = p ;
curlist .tailfield = newkern ( - a - delta ) ;
mem [(long) curlist .tailfield ] .hh.b1 = 2 ;
mem [(long) p ] .hh .v.RH = curlist .tailfield ;
p = q ;
}
mem [(long) curlist .tailfield ] .hh .v.RH = p ;
curlist .tailfield = p ;
curlist .auxfield = 1000 ;
}
/*printf("a,w,h,x %ld %ld %ld %ld\n",a,w,h,x);
printf("t,s %f %f\n",t,s);
printf("delta %ld %f\n",delta,((float)delta/65536.));
*/
}
alignerror () { r_alignerror
if ( abs ( alignstate ) > 2 )
{
{
if ( interaction == 3 )
wakeuptermin () ;
printnl ( 133 ) ;
print ( 962 ) ;
}
printcmdchr ( curcmd , curchr ) ;
if ( curtok == 1062 )
{
{
helpptr = 6 ;
helpline [ 5 ] = 963 ;
helpline [ 4 ] = 964 ;
helpline [ 3 ] = 965 ;
helpline [ 2 ] = 966 ;
helpline [ 1 ] = 967 ;
helpline [ 0 ] = 968 ;
}
}
else {
{
helpptr = 5 ;
helpline [ 4 ] = 963 ;
helpline [ 3 ] = 969 ;
helpline [ 2 ] = 966 ;
helpline [ 1 ] = 967 ;
helpline [ 0 ] = 968 ;
}
}
error () ;
}
else {
backinput () ;
if ( alignstate < 0 )
{
{
if ( interaction == 3 )
wakeuptermin () ;
printnl ( 133 ) ;
print ( 515 ) ;
}
incr ( alignstate ) ;
curtok = 379 ;
}
else {
{
if ( interaction == 3 )
wakeuptermin () ;
printnl ( 133 ) ;
print ( 958 ) ;
}
decr ( alignstate ) ;
curtok = 637 ;
}
{
helpptr = 3 ;
helpline [ 2 ] = 959 ;
helpline [ 1 ] = 960 ;
helpline [ 0 ] = 961 ;
}
inserror () ;
}
}
noalignerror () { r_noalignerror
{
if ( interaction == 3 )
wakeuptermin () ;
printnl ( 133 ) ;
print ( 962 ) ;
}
printesc ( 386 ) ;
{
helpptr = 2 ;
helpline [ 1 ] = 970 ;
helpline [ 0 ] = 971 ;
}
error () ;
}
omiterror () { r_omiterror
{
if ( interaction == 3 )
wakeuptermin () ;
printnl ( 133 ) ;
print ( 962 ) ;
}
printesc ( 388 ) ;
{
helpptr = 2 ;
helpline [ 1 ] = 972 ;
helpline [ 0 ] = 971 ;
}
error () ;
}
doendv () { r_doendv
if ( curgroup == 6 )
{
endgraf () ;
if ( fincol () )
finrow () ;
}
else offsave () ;
}
cserror () { r_cserror
{
if ( interaction == 3 )
wakeuptermin () ;
printnl ( 133 ) ;
print ( 633 ) ;
}
printesc ( 364 ) ;
{
helpptr = 1 ;
helpline [ 0 ] = 974 ;
}
error () ;
}
zpushmath ( c )
groupcode c ;
{r_pushmath
pushnest () ;
curlist .modefield = - 201 ;
curlist .auxfield = 0 ;
newsavelevel ( c ) ;
}
initmath () { /* 21 40 45 30 */ r_initmath
scaled w ;
scaled l ;
scaled s ;
halfword p ;
halfword q ;
internalfont f ;
integer n ;
scaled v ;
scaled d ;
fourquarters qi;
gettoken () ;
if ( ( curcmd == 3 ) && ( curlist .modefield > 0 ) )
{
if ( curlist .headfield == curlist .tailfield )
{
popnest () ;
w = - 1073741823 ;
}
else {
linebreak ( eqtb [ 5274 ] .cint ) ;
v = mem [(long) justbox + 4 ] .cint + 2 * fontinfo [ 6 + parambase [ eqtb [
4578 ] .hh .v.RH ] ] .cint ;
w = - 1073741823 ;
p = mem [(long) justbox + 5 ] .hh .v.RH ;
while ( p != 0 ) {
lab21: if ( ( p >= himemmin ) )
{
f = mem [(long) p ] .hh.b0 ;
/* d = fontinfo [ widthbase [ f ] + fontinfo [ charbase [ f ] + mem [(long) p
] .hh.b1 ] .qqqq .b0 ] .cint ;
*/
qi = fontinfo [ charbase [ f ] + mem [(long) p ] .hh.b1 ] .qqqq;
d = fontinfo [ widthbase [ f ] + qi .b0 ] .cint ;
goto lab40 ;
}
switch ( mem [(long) p ] .hh.b0 )
{case 0 :
case 1 :
case 2 :
{
d = mem [(long) p + 1 ] .cint ;
goto lab40 ;
}
break ;
case 6 :
{
mem [(long) memtop - 12 ] = mem [(long) p + 1 ] ;
mem [(long) memtop - 12 ] .hh .v.RH = mem [(long) p ] .hh .v.RH ;
p = memtop - 12 ;
goto lab21 ;
}
break ;
case 11 :
case 9 :
d = mem [(long) p + 1 ] .cint ;
break ;
case 10 :
{
q = mem [(long) p + 1 ] .hh .v.LH ;
d = mem [(long) q + 1 ] .cint ;
if ( mem [(long) justbox + 5 ] .hh.b0 == 1 )
{
if ( ( mem [(long) justbox + 5 ] .hh.b1 == mem [(long) q ] .hh.b0 ) && ( mem
[ q + 2 ] .cint != 0 ) )
v = 1073741823 ;
}
else if ( mem [(long) justbox + 5 ] .hh.b0 == 2 )
{
if ( ( mem [(long) justbox + 5 ] .hh.b1 == mem [(long) q ] .hh.b1 ) && ( mem
[ q + 3 ] .cint != 0 ) )
v = 1073741823 ;
}
if ( mem [(long) p ] .hh.b1 >= 100 )
goto lab40 ;
}
break ;
case 8 :
d = 0 ;
break ;
default :
d = 0 ;
break ;
}
if ( v < 1073741823 )
v = v + d ;
goto lab45 ;
lab40: if ( v < 1073741823 )
{
v = v + d ;
w = v ;
}
else {
w = 1073741823 ;
goto lab30 ;
}
lab45: p = mem [(long) p ] .hh .v.RH ;
}
lab30: ;
}
if ( eqtb [ 4056 ] .hh .v.RH == 0 )
if ( ( eqtb [ 5718 ] .cint != 0 ) && ( ( ( eqtb [ 5308 ] .cint >= 0 ) && (
curlist .pgfield + 2 > eqtb [ 5308 ] .cint ) ) || ( curlist .pgfield + 1 <
- eqtb [ 5308 ] .cint ) ) )
{
l = eqtb [ 5704 ] .cint - abs ( eqtb [ 5718 ] .cint ) ;
if ( eqtb [ 5718 ] .cint > 0 )
s = eqtb [ 5718 ] .cint ;
else s = 0 ;
}
else {
l = eqtb [ 5704 ] .cint ;
s = 0 ;
}
else {
n = mem [(long) eqtb [ 4056 ] .hh .v.RH ] .hh .v.LH ;
if ( curlist .pgfield + 2 >= n )
p = eqtb [ 4056 ] .hh .v.RH + 2 * n ;
else p = eqtb [ 4056 ] .hh .v.RH + 2 * ( curlist .pgfield + 2 ) ;
s = mem [(long) p - 1 ] .cint ;
l = mem [(long) p ] .cint ;
}
pushmath ( 15 ) ;
curlist .modefield = 201 ;
eqworddefine ( 5311 , - 1 ) ;
eqworddefine ( 5714 , w ) ;
eqworddefine ( 5715 , l ) ;
eqworddefine ( 5716 , s ) ;
if ( eqtb [ 4060 ] .hh .v.RH != 0 )
begintokenli ( eqtb [ 4060 ] .hh .v.RH , 9 ) ;
if ( nestptr == 1 )
buildpage () ;
}
else {
backinput () ;
{
pushmath ( 15 ) ;
eqworddefine ( 5311 , - 1 ) ;
if ( eqtb [ 4059 ] .hh .v.RH != 0 )
begintokenli ( eqtb [ 4059 ] .hh .v.RH , 8 ) ;
}
}
}
starteqno () { r_starteqno
savestack [ saveptr + 0 ] .cint = curchr ;
incr ( saveptr ) ;
{
pushmath ( 15 ) ;
eqworddefine ( 5311 , - 1 ) ;
if ( eqtb [ 4059 ] .hh .v.RH != 0 )
begintokenli ( eqtb [ 4059 ] .hh .v.RH , 8 ) ;
}
}
zscanmath ( p )
halfword p ;
{/* 20 21 10 */ r_scanmath
integer c ;
lab20: do { getxtoken () ;
} while ( ! ( ( curcmd != 10 ) && ( curcmd != 0 ) ) ) ;
lab21: switch ( curcmd )
{case 11 :
case 12 :
case 67 :
if ( curchr >= 128 )
c = curchr ;
else {
c = eqtb [ 5139 + curchr ] .hh .v.RH ;
if ( c == 32768 )
{
{
curcs = curchr + 1 ;
curcmd = eqtb [ curcs ] .hh.b0 ;
curchr = eqtb [ curcs ] .hh .v.RH ;
xtoken () ;
backinput () ;
}
goto lab20 ;
}
}
break ;
case 16 :
{
scancharnum () ;
curchr = curval ;
curcmd = 67 ;
goto lab21 ;
}
break ;
case 17 :
{
scanfifteenb () ;
c = curval ;
}
break ;
case 68 :
c = curchr ;
break ;
case 15 :
{
scantwentyse () ;
c = curval / 4096 ;
}
break ;
default :
{
backinput () ;
scanleftbrac () ;
savestack [ saveptr + 0 ] .cint = p ;
incr ( saveptr ) ;
pushmath ( 9 ) ;
return ;
}
break ;
}
mem [(long) p ] .hh .v.RH = 1 ;
mem [(long) p ] .hh.b1 = c % 256 ;
if ( ( c >= 28672 ) && ( ( eqtb [ 5311 ] .cint >= 0 ) && ( eqtb [ 5311 ]
.cint < 16 ) ) )
mem [(long) p ] .hh.b0 = eqtb [ 5311 ] .cint ;
else mem [(long) p ] .hh.b0 = ( c / 256 ) % 16 ;
}
zsetmathchar ( c )
integer c ;
{r_setmathchar
halfword p ;
if ( c >= 32768 )
{
curcs = curchr + 1 ;
curcmd = eqtb [ curcs ] .hh.b0 ;
curchr = eqtb [ curcs ] .hh .v.RH ;
xtoken () ;
backinput () ;
}
else {
p = newnoad () ;
mem [(long) p + 1 ] .hh .v.RH = 1 ;
mem [(long) p + 1 ] .hh.b1 = c % 256 ;
mem [(long) p + 1 ] .hh.b0 = ( c / 256 ) % 16 ;
if ( c >= 28672 )
{
if ( ( ( eqtb [ 5311 ] .cint >= 0 ) && ( eqtb [ 5311 ] .cint < 16 ) ) )
mem [(long) p + 1 ] .hh.b0 = eqtb [ 5311 ] .cint ;
mem [(long) p ] .hh.b0 = 16 ;
}
else mem [(long) p ] .hh.b0 = 16 + ( c / 4096 ) ;
mem [(long) curlist .tailfield ] .hh .v.RH = p ;
curlist .tailfield = p ;
}
}