home *** CD-ROM | disk | FTP | other *** search
- #define EXTERN extern
- #include "texd.h"
-
- void zpostlinebreak ( finalwidowpenalty )
- integer finalwidowpenalty ;
- {/* 30 31 */ postlinebreak_regmem
- halfword q, r, s ;
- boolean discbreak ;
- boolean postdiscbreak ;
- scaled curwidth ;
- scaled curindent ;
- quarterword t ;
- integer pen ;
- halfword curline ;
- q = mem [ bestbet + 1 ] .hh .v.RH ;
- curp = 0 ;
- do {
- r = q ;
- q = mem [ q + 1 ] .hh .v.LH ;
- mem [ r + 1 ] .hh .v.LH = curp ;
- curp = r ;
- } while ( ! ( q == 0 ) ) ;
- curline = curlist .pgfield + 1 ;
- do {
- q = mem [ curp + 1 ] .hh .v.RH ;
- discbreak = false ;
- postdiscbreak = false ;
- if ( q != 0 )
- if ( mem [ q ] .hh.b0 == 10 )
- {
- deleteglueref ( mem [ q + 1 ] .hh .v.LH ) ;
- mem [ q + 1 ] .hh .v.LH = eqtb [ 3790 ] .hh .v.RH ;
- mem [ q ] .hh.b1 = 9 ;
- incr ( mem [ eqtb [ 3790 ] .hh .v.RH ] .hh .v.RH ) ;
- goto lab30 ;
- }
- else {
-
- if ( mem [ q ] .hh.b0 == 7 )
- {
- t = mem [ q ] .hh.b1 ;
- if ( t == 0 )
- r = mem [ q ] .hh .v.RH ;
- else {
-
- r = q ;
- while ( t > 1 ) {
-
- r = mem [ r ] .hh .v.RH ;
- decr ( t ) ;
- }
- s = mem [ r ] .hh .v.RH ;
- if ( ! ( s >= himemmin ) )
- if ( mem [ curp + 1 ] .hh .v.LH != 0 )
- if ( mem [ mem [ curp + 1 ] .hh .v.LH + 1 ] .hh .v.RH == s )
- s = r ;
- r = mem [ s ] .hh .v.RH ;
- mem [ s ] .hh .v.RH = 0 ;
- flushnodelist ( mem [ q ] .hh .v.RH ) ;
- mem [ q ] .hh.b1 = 0 ;
- }
- if ( mem [ q + 1 ] .hh .v.RH != 0 )
- {
- s = mem [ q + 1 ] .hh .v.RH ;
- while ( mem [ s ] .hh .v.RH != 0 ) s = mem [ s ] .hh .v.RH ;
- mem [ s ] .hh .v.RH = r ;
- r = mem [ q + 1 ] .hh .v.RH ;
- mem [ q + 1 ] .hh .v.RH = 0 ;
- postdiscbreak = true ;
- }
- if ( mem [ q + 1 ] .hh .v.LH != 0 )
- {
- s = mem [ q + 1 ] .hh .v.LH ;
- mem [ q ] .hh .v.RH = s ;
- while ( mem [ s ] .hh .v.RH != 0 ) s = mem [ s ] .hh .v.RH ;
- mem [ q + 1 ] .hh .v.LH = 0 ;
- q = s ;
- }
- mem [ q ] .hh .v.RH = r ;
- discbreak = true ;
- }
- else if ( ( mem [ q ] .hh.b0 == 9 ) || ( mem [ q ] .hh.b0 == 11 ) )
- mem [ q + 1 ] .cint = 0 ;
- }
- else {
-
- q = memtop - 3 ;
- while ( mem [ q ] .hh .v.RH != 0 ) q = mem [ q ] .hh .v.RH ;
- }
- r = newparamglue ( 8 ) ;
- mem [ r ] .hh .v.RH = mem [ q ] .hh .v.RH ;
- mem [ q ] .hh .v.RH = r ;
- q = r ;
- lab30: ;
- r = mem [ q ] .hh .v.RH ;
- mem [ q ] .hh .v.RH = 0 ;
- q = mem [ memtop - 3 ] .hh .v.RH ;
- mem [ memtop - 3 ] .hh .v.RH = r ;
- if ( eqtb [ 3789 ] .hh .v.RH != 0 )
- {
- r = newparamglue ( 7 ) ;
- mem [ r ] .hh .v.RH = q ;
- q = r ;
- }
- if ( curline > lastspecialline )
- {
- curwidth = secondwidth ;
- curindent = secondindent ;
- }
- else if ( eqtb [ 4312 ] .hh .v.RH == 0 )
- {
- curwidth = firstwidth ;
- curindent = firstindent ;
- }
- else {
-
- curwidth = mem [ eqtb [ 4312 ] .hh .v.RH + 2 * curline ] .cint ;
- curindent = mem [ eqtb [ 4312 ] .hh .v.RH + 2 * curline - 1 ] .cint ;
- }
- adjusttail = memtop - 5 ;
- justbox = hpack ( q , curwidth , 0 ) ;
- mem [ justbox + 4 ] .cint = curindent ;
- appendtovlist ( justbox ) ;
- if ( memtop - 5 != adjusttail )
- {
- mem [ curlist .tailfield ] .hh .v.RH = mem [ memtop - 5 ] .hh .v.RH ;
- curlist .tailfield = adjusttail ;
- }
- adjusttail = 0 ;
- if ( curline + 1 != bestline )
- {
- pen = eqtb [ 6176 ] .cint ;
- if ( curline == curlist .pgfield + 1 )
- pen = pen + eqtb [ 6168 ] .cint ;
- if ( curline + 2 == bestline )
- pen = pen + finalwidowpenalty ;
- if ( discbreak )
- pen = pen + eqtb [ 6171 ] .cint ;
- if ( pen != 0 )
- {
- r = newpenalty ( pen ) ;
- mem [ curlist .tailfield ] .hh .v.RH = r ;
- curlist .tailfield = r ;
- }
- }
- incr ( curline ) ;
- curp = mem [ curp + 1 ] .hh .v.LH ;
- if ( curp != 0 )
- if ( ! postdiscbreak )
- {
- r = memtop - 3 ;
- while ( true ) {
-
- q = mem [ r ] .hh .v.RH ;
- if ( q == mem [ curp + 1 ] .hh .v.RH )
- goto lab31 ;
- if ( ( q >= himemmin ) )
- goto lab31 ;
- if ( ( mem [ q ] .hh.b0 < 9 ) )
- goto lab31 ;
- if ( mem [ q ] .hh.b1 == 2 )
- if ( mem [ q ] .hh.b0 == 11 )
- goto lab31 ;
- r = q ;
- }
- lab31: if ( r != memtop - 3 )
- {
- mem [ r ] .hh .v.RH = 0 ;
- flushnodelist ( mem [ memtop - 3 ] .hh .v.RH ) ;
- mem [ memtop - 3 ] .hh .v.RH = q ;
- }
- }
- } while ( ! ( curp == 0 ) ) ;
- if ( ( curline != bestline ) || ( mem [ memtop - 3 ] .hh .v.RH != 0 ) )
- confusion ( 932 ) ;
- curlist .pgfield = bestline - 1 ;
- }
- smallnumber zreconstitute ( j , n , bchar , hchar )
- smallnumber j ;
- smallnumber n ;
- halfword bchar ;
- halfword hchar ;
- {/* 22 30 */ register smallnumber Result; reconstitute_regmem
- halfword p ;
- halfword t ;
- fourquarters q ;
- halfword currh ;
- halfword testchar ;
- scaled w ;
- fontindex k ;
- hyphenpassed = 0 ;
- t = memtop - 4 ;
- w = 0 ;
- mem [ memtop - 4 ] .hh .v.RH = 0 ;
- curl = hu [ j ] ;
- curq = t ;
- if ( j == 0 )
- {
- ligaturepresent = initlig ;
- p = initlist ;
- if ( ligaturepresent )
- lfthit = initlft ;
- while ( p > 0 ) {
-
- {
- mem [ t ] .hh .v.RH = getavail () ;
- t = mem [ t ] .hh .v.RH ;
- mem [ t ] .hh.b0 = hf ;
- mem [ t ] .hh.b1 = mem [ p ] .hh.b1 ;
- }
- p = mem [ p ] .hh .v.RH ;
- }
- }
- else if ( curl < 256 )
- {
- mem [ t ] .hh .v.RH = getavail () ;
- t = mem [ t ] .hh .v.RH ;
- mem [ t ] .hh.b0 = hf ;
- mem [ t ] .hh.b1 = curl ;
- }
- ligstack = 0 ;
- {
- if ( j < n )
- curr = hu [ j + 1 ] ;
- else curr = bchar ;
- if ( odd ( hyf [ j ] ) )
- currh = hchar ;
- else currh = 256 ;
- }
- lab22: if ( curl == 256 )
- {
- k = bcharlabel [ hf ] ;
- if ( k == fontmemsize )
- goto lab30 ;
- else q = fontinfo [ k ] .qqqq ;
- }
- else {
-
- q = fontinfo [ charbase [ hf ] + curl ] .qqqq ;
- if ( ( ( q .b2 ) % 4 ) != 1 )
- goto lab30 ;
- k = ligkernbase [ hf ] + q .b3 ;
- q = fontinfo [ k ] .qqqq ;
- if ( q .b0 > 128 )
- {
- k = ligkernbase [ hf ] + 256 * q .b2 + q .b3 + 32768L - 256 * ( 128 ) ;
- q = fontinfo [ k ] .qqqq ;
- }
- }
- if ( currh < 256 )
- testchar = currh ;
- else testchar = curr ;
- while ( true ) {
-
- if ( q .b1 == testchar )
- if ( q .b0 <= 128 )
- if ( currh < 256 )
- {
- hyphenpassed = j ;
- hchar = 256 ;
- currh = 256 ;
- goto lab22 ;
- }
- else {
-
- if ( hchar < 256 )
- if ( odd ( hyf [ j ] ) )
- {
- hyphenpassed = j ;
- hchar = 256 ;
- }
- if ( q .b2 < 128 )
- {
- if ( curl == 256 )
- lfthit = true ;
- if ( j == n )
- if ( ligstack == 0 )
- rthit = true ;
- {
- if ( interrupt != 0 )
- pauseforinstructions () ;
- }
- switch ( q .b2 )
- {case 1 :
- case 5 :
- {
- curl = q .b3 ;
- ligaturepresent = true ;
- }
- break ;
- case 2 :
- case 6 :
- {
- curr = q .b3 ;
- if ( ligstack > 0 )
- mem [ ligstack ] .hh.b1 = curr ;
- else {
-
- ligstack = newligitem ( curr ) ;
- if ( j == n )
- bchar = 256 ;
- else {
-
- p = getavail () ;
- mem [ ligstack + 1 ] .hh .v.RH = p ;
- mem [ p ] .hh.b1 = hu [ j + 1 ] ;
- mem [ p ] .hh.b0 = hf ;
- }
- }
- }
- break ;
- case 3 :
- {
- curr = q .b3 ;
- p = ligstack ;
- ligstack = newligitem ( curr ) ;
- mem [ ligstack ] .hh .v.RH = p ;
- }
- break ;
- case 7 :
- case 11 :
- {
- if ( ligaturepresent )
- {
- p = newligature ( hf , curl , mem [ curq ] .hh .v.RH ) ;
- if ( lfthit )
- {
- mem [ p ] .hh.b1 = 2 ;
- lfthit = false ;
- }
- if ( false )
- if ( ligstack == 0 )
- {
- incr ( mem [ p ] .hh.b1 ) ;
- rthit = false ;
- }
- mem [ curq ] .hh .v.RH = p ;
- t = p ;
- ligaturepresent = false ;
- }
- curq = t ;
- curl = q .b3 ;
- ligaturepresent = true ;
- }
- break ;
- default:
- {
- curl = q .b3 ;
- ligaturepresent = true ;
- if ( ligstack > 0 )
- {
- if ( mem [ ligstack + 1 ] .hh .v.RH > 0 )
- {
- mem [ t ] .hh .v.RH = mem [ ligstack + 1 ] .hh .v.RH ;
- t = mem [ t ] .hh .v.RH ;
- incr ( j ) ;
- }
- p = ligstack ;
- ligstack = mem [ p ] .hh .v.RH ;
- freenode ( p , 2 ) ;
- if ( ligstack == 0 )
- {
- if ( j < n )
- curr = hu [ j + 1 ] ;
- else curr = bchar ;
- if ( odd ( hyf [ j ] ) )
- currh = hchar ;
- else currh = 256 ;
- }
- else curr = mem [ ligstack ] .hh.b1 ;
- }
- else if ( j == n )
- goto lab30 ;
- else {
-
- {
- mem [ t ] .hh .v.RH = getavail () ;
- t = mem [ t ] .hh .v.RH ;
- mem [ t ] .hh.b0 = hf ;
- mem [ t ] .hh.b1 = curr ;
- }
- incr ( j ) ;
- {
- if ( j < n )
- curr = hu [ j + 1 ] ;
- else curr = bchar ;
- if ( odd ( hyf [ j ] ) )
- currh = hchar ;
- else currh = 256 ;
- }
- }
- }
- break ;
- }
- if ( q .b2 > 4 )
- if ( q .b2 != 7 )
- goto lab30 ;
- goto lab22 ;
- }
- w = fontinfo [ kernbase [ hf ] + 256 * q .b2 + q .b3 ] .cint ;
- goto lab30 ;
- }
- if ( q .b0 >= 128 )
- if ( currh == 256 )
- goto lab30 ;
- else {
-
- currh = 256 ;
- goto lab22 ;
- }
- k = k + q .b0 + 1 ;
- q = fontinfo [ k ] .qqqq ;
- }
- lab30: ;
- if ( ligaturepresent )
- {
- p = newligature ( hf , curl , mem [ curq ] .hh .v.RH ) ;
- if ( lfthit )
- {
- mem [ p ] .hh.b1 = 2 ;
- lfthit = false ;
- }
- if ( rthit )
- if ( ligstack == 0 )
- {
- incr ( mem [ p ] .hh.b1 ) ;
- rthit = false ;
- }
- mem [ curq ] .hh .v.RH = p ;
- t = p ;
- ligaturepresent = false ;
- }
- if ( w != 0 )
- {
- mem [ t ] .hh .v.RH = newkern ( w ) ;
- t = mem [ t ] .hh .v.RH ;
- w = 0 ;
- }
- if ( ligstack > 0 )
- {
- curq = t ;
- curl = mem [ ligstack ] .hh.b1 ;
- ligaturepresent = true ;
- {
- if ( mem [ ligstack + 1 ] .hh .v.RH > 0 )
- {
- mem [ t ] .hh .v.RH = mem [ ligstack + 1 ] .hh .v.RH ;
- t = mem [ t ] .hh .v.RH ;
- incr ( j ) ;
- }
- p = ligstack ;
- ligstack = mem [ p ] .hh .v.RH ;
- freenode ( p , 2 ) ;
- if ( ligstack == 0 )
- {
- if ( j < n )
- curr = hu [ j + 1 ] ;
- else curr = bchar ;
- if ( odd ( hyf [ j ] ) )
- currh = hchar ;
- else currh = 256 ;
- }
- else curr = mem [ ligstack ] .hh.b1 ;
- }
- goto lab22 ;
- }
- Result = j ;
- return(Result) ;
- }
- void hyphenate ( )
- {/* 50 30 40 41 42 45 10 */ hyphenate_regmem
- schar i, j, l ;
- halfword q, r, s ;
- halfword bchar ;
- halfword majortail, minortail ;
- ASCIIcode c ;
- schar cloc ;
- integer rcount ;
- halfword hyfnode ;
- triepointer z ;
- integer v ;
- hyphpointer h ;
- strnumber k ;
- poolpointer u ;
- {register integer for_end; j = 0 ; for_end = hn ; if ( j <= for_end) do
- hyf [ j ] = 0 ;
- while ( j++ < for_end ) ; }
- h = hc [ 1 ] ;
- incr ( hn ) ;
- hc [ hn ] = curlang ;
- {register integer for_end; j = 2 ; for_end = hn ; if ( j <= for_end) do
- h = ( h + h + hc [ j ] ) % 307 ;
- while ( j++ < for_end ) ; }
- while ( true ) {
-
- k = hyphword [ h ] ;
- if ( k == 0 )
- goto lab45 ;
- if ( ( strstart [ k + 1 ] - strstart [ k ] ) < hn )
- goto lab45 ;
- if ( ( strstart [ k + 1 ] - strstart [ k ] ) == hn )
- {
- j = 1 ;
- u = strstart [ k ] ;
- do {
- if ( strpool [ u ] < hc [ j ] )
- goto lab45 ;
- if ( strpool [ u ] > hc [ j ] )
- goto lab30 ;
- incr ( j ) ;
- incr ( u ) ;
- } while ( ! ( j > hn ) ) ;
- s = hyphlist [ h ] ;
- while ( s != 0 ) {
-
- hyf [ mem [ s ] .hh .v.LH ] = 1 ;
- s = mem [ s ] .hh .v.RH ;
- }
- decr ( hn ) ;
- goto lab40 ;
- }
- lab30: ;
- if ( h > 0 )
- decr ( h ) ;
- else h = 307 ;
- }
- lab45: decr ( hn ) ;
- if ( trietrc [ curlang + 1 ] != curlang )
- return ;
- hc [ 0 ] = 0 ;
- hc [ hn + 1 ] = 0 ;
- hc [ hn + 2 ] = 256 ;
- {register integer for_end; j = 0 ; for_end = hn - rhyf + 1 ; if ( j <=
- for_end) do
- {
- z = trietrl [ curlang + 1 ] + hc [ j ] ;
- l = j ;
- while ( hc [ l ] == trietrc [ z ] ) {
-
- if ( trietro [ z ] != mintrieop )
- {
- v = trietro [ z ] ;
- do {
- v = v + opstart [ curlang ] ;
- i = l - hyfdistance [ v ] ;
- if ( hyfnum [ v ] > hyf [ i ] )
- hyf [ i ] = hyfnum [ v ] ;
- v = hyfnext [ v ] ;
- } while ( ! ( v == mintrieop ) ) ;
- }
- incr ( l ) ;
- z = trietrl [ z ] + hc [ l ] ;
- }
- }
- while ( j++ < for_end ) ; }
- lab40: {
- register integer for_end; j = 0 ; for_end = lhyf - 1 ; if ( j <=
- for_end) do
- hyf [ j ] = 0 ;
- while ( j++ < for_end ) ; }
- {register integer for_end; j = 0 ; for_end = rhyf - 1 ; if ( j <= for_end)
- do
- hyf [ hn - j ] = 0 ;
- while ( j++ < for_end ) ; }
- {register integer for_end; j = lhyf ; for_end = hn - rhyf ; if ( j <=
- for_end) do
- if ( odd ( hyf [ j ] ) )
- goto lab41 ;
- while ( j++ < for_end ) ; }
- return ;
- lab41: ;
- q = mem [ hb ] .hh .v.RH ;
- mem [ hb ] .hh .v.RH = 0 ;
- r = mem [ ha ] .hh .v.RH ;
- mem [ ha ] .hh .v.RH = 0 ;
- bchar = 256 ;
- if ( ! ( hb >= himemmin ) )
- if ( mem [ hb ] .hh.b0 == 6 )
- if ( odd ( mem [ hb ] .hh.b1 ) )
- bchar = fontbchar [ hf ] ;
- if ( ( ha >= himemmin ) )
- if ( mem [ ha ] .hh.b0 != hf )
- goto lab42 ;
- else {
-
- initlist = ha ;
- initlig = false ;
- hu [ 0 ] = mem [ ha ] .hh.b1 ;
- }
- else if ( mem [ ha ] .hh.b0 == 6 )
- if ( mem [ ha + 1 ] .hh.b0 != hf )
- goto lab42 ;
- else {
-
- initlist = mem [ ha + 1 ] .hh .v.RH ;
- initlig = true ;
- initlft = ( mem [ ha ] .hh.b1 > 1 ) ;
- hu [ 0 ] = mem [ ha + 1 ] .hh.b1 ;
- if ( initlist == 0 )
- if ( initlft )
- {
- hu [ 0 ] = 256 ;
- initlig = false ;
- }
- freenode ( ha , 2 ) ;
- }
- else {
-
- if ( ! ( r >= himemmin ) )
- if ( mem [ r ] .hh.b0 == 6 )
- if ( mem [ r ] .hh.b1 > 1 )
- goto lab42 ;
- j = 1 ;
- s = ha ;
- initlist = 0 ;
- goto lab50 ;
- }
- s = curp ;
- while ( mem [ s ] .hh .v.RH != ha ) s = mem [ s ] .hh .v.RH ;
- j = 0 ;
- goto lab50 ;
- lab42: s = ha ;
- j = 0 ;
- hu [ 0 ] = 256 ;
- initlig = false ;
- initlist = 0 ;
- lab50: flushnodelist ( r ) ;
- do {
- l = j ;
- j = reconstitute ( j , hn , bchar , hyfchar ) + 1 ;
- if ( hyphenpassed == 0 )
- {
- mem [ s ] .hh .v.RH = mem [ memtop - 4 ] .hh .v.RH ;
- while ( mem [ s ] .hh .v.RH > 0 ) s = mem [ s ] .hh .v.RH ;
- if ( odd ( hyf [ j - 1 ] ) )
- {
- l = j ;
- hyphenpassed = j - 1 ;
- mem [ memtop - 4 ] .hh .v.RH = 0 ;
- }
- }
- if ( hyphenpassed > 0 )
- do {
- r = getnode ( 2 ) ;
- mem [ r ] .hh .v.RH = mem [ memtop - 4 ] .hh .v.RH ;
- mem [ r ] .hh.b0 = 7 ;
- majortail = r ;
- rcount = 0 ;
- while ( mem [ majortail ] .hh .v.RH > 0 ) {
-
- majortail = mem [ majortail ] .hh .v.RH ;
- incr ( rcount ) ;
- }
- i = hyphenpassed ;
- hyf [ i ] = 0 ;
- minortail = 0 ;
- mem [ r + 1 ] .hh .v.LH = 0 ;
- hyfnode = newcharacter ( hf , hyfchar ) ;
- if ( hyfnode != 0 )
- {
- incr ( i ) ;
- c = hu [ i ] ;
- hu [ i ] = hyfchar ;
- {
- mem [ hyfnode ] .hh .v.RH = avail ;
- avail = hyfnode ;
- ;
- #ifdef STAT
- decr ( dynused ) ;
- #endif /* STAT */
- }
- }
- while ( l <= i ) {
-
- l = reconstitute ( l , i , fontbchar [ hf ] , 256 ) + 1 ;
- if ( mem [ memtop - 4 ] .hh .v.RH > 0 )
- {
- if ( minortail == 0 )
- mem [ r + 1 ] .hh .v.LH = mem [ memtop - 4 ] .hh .v.RH ;
- else mem [ minortail ] .hh .v.RH = mem [ memtop - 4 ] .hh .v.RH ;
- minortail = mem [ memtop - 4 ] .hh .v.RH ;
- while ( mem [ minortail ] .hh .v.RH > 0 ) minortail = mem [
- minortail ] .hh .v.RH ;
- }
- }
- if ( hyfnode != 0 )
- {
- hu [ i ] = c ;
- l = i ;
- decr ( i ) ;
- }
- minortail = 0 ;
- mem [ r + 1 ] .hh .v.RH = 0 ;
- cloc = 0 ;
- if ( bcharlabel [ hf ] < fontmemsize )
- {
- decr ( l ) ;
- c = hu [ l ] ;
- cloc = l ;
- hu [ l ] = 256 ;
- }
- while ( l < j ) {
-
- do {
- l = reconstitute ( l , hn , bchar , 256 ) + 1 ;
- if ( cloc > 0 )
- {
- hu [ cloc ] = c ;
- cloc = 0 ;
- }
- if ( mem [ memtop - 4 ] .hh .v.RH > 0 )
- {
- if ( minortail == 0 )
- mem [ r + 1 ] .hh .v.RH = mem [ memtop - 4 ] .hh .v.RH ;
- else mem [ minortail ] .hh .v.RH = mem [ memtop - 4 ] .hh .v.RH ;
- minortail = mem [ memtop - 4 ] .hh .v.RH ;
- while ( mem [ minortail ] .hh .v.RH > 0 ) minortail = mem [
- minortail ] .hh .v.RH ;
- }
- } while ( ! ( l >= j ) ) ;
- while ( l > j ) {
-
- j = reconstitute ( j , hn , bchar , 256 ) + 1 ;
- mem [ majortail ] .hh .v.RH = mem [ memtop - 4 ] .hh .v.RH ;
- while ( mem [ majortail ] .hh .v.RH > 0 ) {
-
- majortail = mem [ majortail ] .hh .v.RH ;
- incr ( rcount ) ;
- }
- }
- }
- if ( rcount > 127 )
- {
- mem [ s ] .hh .v.RH = mem [ r ] .hh .v.RH ;
- mem [ r ] .hh .v.RH = 0 ;
- flushnodelist ( r ) ;
- }
- else {
-
- mem [ s ] .hh .v.RH = r ;
- mem [ r ] .hh.b1 = rcount ;
- }
- s = majortail ;
- hyphenpassed = j - 1 ;
- mem [ memtop - 4 ] .hh .v.RH = 0 ;
- } while ( ! ( ! odd ( hyf [ j - 1 ] ) ) ) ;
- } while ( ! ( j > hn ) ) ;
- mem [ s ] .hh .v.RH = q ;
- flushlist ( initlist ) ;
- }
- void newhyphexceptions ( )
- {/* 21 10 40 45 */ newhyphexceptions_regmem
- smallnumber n ;
- smallnumber j ;
- hyphpointer h ;
- strnumber k ;
- halfword p ;
- halfword q ;
- strnumber s, t ;
- poolpointer u, v ;
- scanleftbrace () ;
- if ( eqtb [ 6213 ] .cint <= 0 )
- curlang = 0 ;
- else if ( eqtb [ 6213 ] .cint > 255 )
- curlang = 0 ;
- else curlang = eqtb [ 6213 ] .cint ;
- n = 0 ;
- p = 0 ;
- while ( true ) {
-
- getxtoken () ;
- lab21: switch ( curcmd )
- {case 11 :
- case 12 :
- case 68 :
- if ( curchr == 45 )
- {
- if ( n < 63 )
- {
- q = getavail () ;
- mem [ q ] .hh .v.RH = p ;
- mem [ q ] .hh .v.LH = n ;
- p = q ;
- }
- }
- else {
-
- if ( eqtb [ 5139 + curchr ] .hh .v.RH == 0 )
- {
- {
- if ( interaction == 3 )
- wakeupterminal () ;
- printnl ( 262 ) ;
- print ( 938 ) ;
- }
- {
- helpptr = 2 ;
- helpline [ 1 ] = 939 ;
- helpline [ 0 ] = 940 ;
- }
- error () ;
- }
- else if ( n < 63 )
- {
- incr ( n ) ;
- hc [ n ] = eqtb [ 5139 + curchr ] .hh .v.RH ;
- }
- }
- break ;
- case 16 :
- {
- scancharnum () ;
- curchr = curval ;
- curcmd = 68 ;
- goto lab21 ;
- }
- break ;
- case 10 :
- case 2 :
- {
- if ( n > 1 )
- {
- incr ( n ) ;
- hc [ n ] = curlang ;
- {
- if ( poolptr + n > poolsize )
- overflow ( 257 , poolsize - initpoolptr ) ;
- }
- h = 0 ;
- {register integer for_end; j = 1 ; for_end = n ; if ( j <= for_end)
- do
- {
- h = ( h + h + hc [ j ] ) % 307 ;
- {
- strpool [ poolptr ] = hc [ j ] ;
- incr ( poolptr ) ;
- }
- }
- while ( j++ < for_end ) ; }
- s = makestring () ;
- if ( hyphcount == 307 )
- overflow ( 941 , 307 ) ;
- incr ( hyphcount ) ;
- while ( hyphword [ h ] != 0 ) {
-
- k = hyphword [ h ] ;
- if ( ( strstart [ k + 1 ] - strstart [ k ] ) < ( strstart [ s + 1
- ] - strstart [ s ] ) )
- goto lab40 ;
- if ( ( strstart [ k + 1 ] - strstart [ k ] ) > ( strstart [ s + 1
- ] - strstart [ s ] ) )
- goto lab45 ;
- u = strstart [ k ] ;
- v = strstart [ s ] ;
- do {
- if ( strpool [ u ] < strpool [ v ] )
- goto lab40 ;
- if ( strpool [ u ] > strpool [ v ] )
- goto lab45 ;
- incr ( u ) ;
- incr ( v ) ;
- } while ( ! ( u == strstart [ k + 1 ] ) ) ;
- lab40: q = hyphlist [ h ] ;
- hyphlist [ h ] = p ;
- p = q ;
- t = hyphword [ h ] ;
- hyphword [ h ] = s ;
- s = t ;
- lab45: ;
- if ( h > 0 )
- decr ( h ) ;
- else h = 307 ;
- }
- hyphword [ h ] = s ;
- hyphlist [ h ] = p ;
- }
- if ( curcmd == 2 )
- return ;
- n = 0 ;
- p = 0 ;
- }
- break ;
- default:
- {
- {
- if ( interaction == 3 )
- wakeupterminal () ;
- printnl ( 262 ) ;
- print ( 676 ) ;
- }
- printesc ( 934 ) ;
- print ( 935 ) ;
- {
- helpptr = 2 ;
- helpline [ 1 ] = 936 ;
- helpline [ 0 ] = 937 ;
- }
- error () ;
- }
- break ;
- }
- }
- }
- halfword zprunepagetop ( p )
- halfword p ;
- {register halfword Result; prunepagetop_regmem
- halfword prevp ;
- halfword q ;
- prevp = memtop - 3 ;
- mem [ memtop - 3 ] .hh .v.RH = p ;
- while ( p != 0 ) switch ( mem [ p ] .hh.b0 )
- {case 0 :
- case 1 :
- case 2 :
- {
- q = newskipparam ( 10 ) ;
- mem [ prevp ] .hh .v.RH = q ;
- mem [ q ] .hh .v.RH = p ;
- if ( mem [ tempptr + 1 ] .cint > mem [ p + 3 ] .cint )
- mem [ tempptr + 1 ] .cint = mem [ tempptr + 1 ] .cint - mem [ p + 3 ]
- .cint ;
- else mem [ tempptr + 1 ] .cint = 0 ;
- p = 0 ;
- }
- break ;
- case 8 :
- case 4 :
- case 3 :
- {
- prevp = p ;
- p = mem [ prevp ] .hh .v.RH ;
- }
- break ;
- case 10 :
- case 11 :
- case 12 :
- {
- q = p ;
- p = mem [ q ] .hh .v.RH ;
- mem [ q ] .hh .v.RH = 0 ;
- mem [ prevp ] .hh .v.RH = p ;
- flushnodelist ( q ) ;
- }
- break ;
- default:
- confusion ( 952 ) ;
- break ;
- }
- Result = mem [ memtop - 3 ] .hh .v.RH ;
- return(Result) ;
- }
- halfword zvertbreak ( p , h , d )
- halfword p ;
- scaled h ;
- scaled d ;
- {/* 30 45 90 */ register halfword Result; vertbreak_regmem
- halfword prevp ;
- halfword q, r ;
- integer pi ;
- integer b ;
- integer leastcost ;
- halfword bestplace ;
- scaled prevdp ;
- smallnumber t ;
- prevp = p ;
- leastcost = 1073741823L ;
- activewidth [ 1 ] = 0 ;
- activewidth [ 2 ] = 0 ;
- activewidth [ 3 ] = 0 ;
- activewidth [ 4 ] = 0 ;
- activewidth [ 5 ] = 0 ;
- activewidth [ 6 ] = 0 ;
- prevdp = 0 ;
- while ( true ) {
-
- if ( p == 0 )
- pi = -10000 ;
- else switch ( mem [ p ] .hh.b0 )
- {case 0 :
- case 1 :
- case 2 :
- {
- activewidth [ 1 ] = activewidth [ 1 ] + prevdp + mem [ p + 3 ] .cint ;
- prevdp = mem [ p + 2 ] .cint ;
- goto lab45 ;
- }
- break ;
- case 8 :
- goto lab45 ;
- break ;
- case 10 :
- if ( ( mem [ prevp ] .hh.b0 < 9 ) )
- pi = 0 ;
- else goto lab90 ;
- break ;
- case 11 :
- {
- if ( mem [ p ] .hh .v.RH == 0 )
- t = 12 ;
- else t = mem [ mem [ p ] .hh .v.RH ] .hh.b0 ;
- if ( t == 10 )
- pi = 0 ;
- else goto lab90 ;
- }
- break ;
- case 12 :
- pi = mem [ p + 1 ] .cint ;
- break ;
- case 4 :
- case 3 :
- goto lab45 ;
- break ;
- default:
- confusion ( 953 ) ;
- break ;
- }
- if ( pi < 10000 )
- {
- if ( activewidth [ 1 ] < h )
- if ( ( activewidth [ 3 ] != 0 ) || ( activewidth [ 4 ] != 0 ) || (
- activewidth [ 5 ] != 0 ) )
- b = 0 ;
- else b = badness ( h - activewidth [ 1 ] , activewidth [ 2 ] ) ;
- else if ( activewidth [ 1 ] - h > activewidth [ 6 ] )
- b = 1073741823L ;
- else b = badness ( activewidth [ 1 ] - h , activewidth [ 6 ] ) ;
- if ( b < 1073741823L )
- if ( pi <= -10000 )
- b = pi ;
- else if ( b < 10000 )
- b = b + pi ;
- else b = 100000L ;
- if ( b <= leastcost )
- {
- bestplace = p ;
- leastcost = b ;
- bestheightplusdepth = activewidth [ 1 ] + prevdp ;
- }
- if ( ( b == 1073741823L ) || ( pi <= -10000 ) )
- goto lab30 ;
- }
- if ( ( mem [ p ] .hh.b0 < 10 ) || ( mem [ p ] .hh.b0 > 11 ) )
- goto lab45 ;
- lab90: if ( mem [ p ] .hh.b0 == 11 )
- q = p ;
- else {
-
- q = mem [ p + 1 ] .hh .v.LH ;
- activewidth [ 2 + mem [ q ] .hh.b0 ] = activewidth [ 2 + mem [ q ]
- .hh.b0 ] + mem [ q + 2 ] .cint ;
- activewidth [ 6 ] = activewidth [ 6 ] + mem [ q + 3 ] .cint ;
- if ( ( mem [ q ] .hh.b1 != 0 ) && ( mem [ q + 3 ] .cint != 0 ) )
- {
- {
- if ( interaction == 3 )
- wakeupterminal () ;
- printnl ( 262 ) ;
- print ( 954 ) ;
- }
- {
- helpptr = 4 ;
- helpline [ 3 ] = 955 ;
- helpline [ 2 ] = 956 ;
- helpline [ 1 ] = 957 ;
- helpline [ 0 ] = 915 ;
- }
- error () ;
- r = newspec ( q ) ;
- mem [ r ] .hh.b1 = 0 ;
- deleteglueref ( q ) ;
- mem [ p + 1 ] .hh .v.LH = r ;
- q = r ;
- }
- }
- activewidth [ 1 ] = activewidth [ 1 ] + prevdp + mem [ q + 1 ] .cint ;
- prevdp = 0 ;
- lab45: if ( prevdp > d )
- {
- activewidth [ 1 ] = activewidth [ 1 ] + prevdp - d ;
- prevdp = d ;
- }
- prevp = p ;
- p = mem [ prevp ] .hh .v.RH ;
- }
- lab30: Result = bestplace ;
- return(Result) ;
- }
-