home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / tex / tex31 / texsrc.lzh / TEXSRC.LZH / tex11.c < prev    next >
Encoding:
C/C++ Source or Header  |  1990-11-28  |  24.4 KB  |  1,088 lines

  1. #define EXTERN extern
  2. #include "texd.h"
  3.  
  4. void zpostlinebreak ( finalwidowpenalty ) 
  5. integer finalwidowpenalty ; 
  6. {/* 30 31 */ postlinebreak_regmem 
  7.   halfword q, r, s  ; 
  8.   boolean discbreak  ; 
  9.   boolean postdiscbreak  ; 
  10.   scaled curwidth  ; 
  11.   scaled curindent  ; 
  12.   quarterword t  ; 
  13.   integer pen  ; 
  14.   halfword curline  ; 
  15.   q = mem [ bestbet + 1 ] .hh .v.RH ; 
  16.   curp = 0 ; 
  17.   do {
  18.       r = q ; 
  19.     q = mem [ q + 1 ] .hh .v.LH ; 
  20.     mem [ r + 1 ] .hh .v.LH = curp ; 
  21.     curp = r ; 
  22.   } while ( ! ( q == 0 ) ) ; 
  23.   curline = curlist .pgfield + 1 ; 
  24.   do {
  25.       q = mem [ curp + 1 ] .hh .v.RH ; 
  26.     discbreak = false ; 
  27.     postdiscbreak = false ; 
  28.     if ( q != 0 ) 
  29.     if ( mem [ q ] .hh.b0 == 10 ) 
  30.     {
  31.       deleteglueref ( mem [ q + 1 ] .hh .v.LH ) ; 
  32.       mem [ q + 1 ] .hh .v.LH = eqtb [ 3790 ] .hh .v.RH ; 
  33.       mem [ q ] .hh.b1 = 9 ; 
  34.       incr ( mem [ eqtb [ 3790 ] .hh .v.RH ] .hh .v.RH ) ; 
  35.       goto lab30 ; 
  36.     } 
  37.     else {
  38.     
  39.       if ( mem [ q ] .hh.b0 == 7 ) 
  40.       {
  41.     t = mem [ q ] .hh.b1 ; 
  42.     if ( t == 0 ) 
  43.     r = mem [ q ] .hh .v.RH ; 
  44.     else {
  45.         
  46.       r = q ; 
  47.       while ( t > 1 ) {
  48.           
  49.         r = mem [ r ] .hh .v.RH ; 
  50.         decr ( t ) ; 
  51.       } 
  52.       s = mem [ r ] .hh .v.RH ; 
  53.       if ( ! ( s >= himemmin ) ) 
  54.       if ( mem [ curp + 1 ] .hh .v.LH != 0 ) 
  55.       if ( mem [ mem [ curp + 1 ] .hh .v.LH + 1 ] .hh .v.RH == s ) 
  56.       s = r ; 
  57.       r = mem [ s ] .hh .v.RH ; 
  58.       mem [ s ] .hh .v.RH = 0 ; 
  59.       flushnodelist ( mem [ q ] .hh .v.RH ) ; 
  60.       mem [ q ] .hh.b1 = 0 ; 
  61.     } 
  62.     if ( mem [ q + 1 ] .hh .v.RH != 0 ) 
  63.     {
  64.       s = mem [ q + 1 ] .hh .v.RH ; 
  65.       while ( mem [ s ] .hh .v.RH != 0 ) s = mem [ s ] .hh .v.RH ; 
  66.       mem [ s ] .hh .v.RH = r ; 
  67.       r = mem [ q + 1 ] .hh .v.RH ; 
  68.       mem [ q + 1 ] .hh .v.RH = 0 ; 
  69.       postdiscbreak = true ; 
  70.     } 
  71.     if ( mem [ q + 1 ] .hh .v.LH != 0 ) 
  72.     {
  73.       s = mem [ q + 1 ] .hh .v.LH ; 
  74.       mem [ q ] .hh .v.RH = s ; 
  75.       while ( mem [ s ] .hh .v.RH != 0 ) s = mem [ s ] .hh .v.RH ; 
  76.       mem [ q + 1 ] .hh .v.LH = 0 ; 
  77.       q = s ; 
  78.     } 
  79.     mem [ q ] .hh .v.RH = r ; 
  80.     discbreak = true ; 
  81.       } 
  82.       else if ( ( mem [ q ] .hh.b0 == 9 ) || ( mem [ q ] .hh.b0 == 11 ) ) 
  83.       mem [ q + 1 ] .cint = 0 ; 
  84.     } 
  85.     else {
  86.     
  87.       q = memtop - 3 ; 
  88.       while ( mem [ q ] .hh .v.RH != 0 ) q = mem [ q ] .hh .v.RH ; 
  89.     } 
  90.     r = newparamglue ( 8 ) ; 
  91.     mem [ r ] .hh .v.RH = mem [ q ] .hh .v.RH ; 
  92.     mem [ q ] .hh .v.RH = r ; 
  93.     q = r ; 
  94.     lab30: ; 
  95.     r = mem [ q ] .hh .v.RH ; 
  96.     mem [ q ] .hh .v.RH = 0 ; 
  97.     q = mem [ memtop - 3 ] .hh .v.RH ; 
  98.     mem [ memtop - 3 ] .hh .v.RH = r ; 
  99.     if ( eqtb [ 3789 ] .hh .v.RH != 0 ) 
  100.     {
  101.       r = newparamglue ( 7 ) ; 
  102.       mem [ r ] .hh .v.RH = q ; 
  103.       q = r ; 
  104.     } 
  105.     if ( curline > lastspecialline ) 
  106.     {
  107.       curwidth = secondwidth ; 
  108.       curindent = secondindent ; 
  109.     } 
  110.     else if ( eqtb [ 4312 ] .hh .v.RH == 0 ) 
  111.     {
  112.       curwidth = firstwidth ; 
  113.       curindent = firstindent ; 
  114.     } 
  115.     else {
  116.     
  117.       curwidth = mem [ eqtb [ 4312 ] .hh .v.RH + 2 * curline ] .cint ; 
  118.       curindent = mem [ eqtb [ 4312 ] .hh .v.RH + 2 * curline - 1 ] .cint ; 
  119.     } 
  120.     adjusttail = memtop - 5 ; 
  121.     justbox = hpack ( q , curwidth , 0 ) ; 
  122.     mem [ justbox + 4 ] .cint = curindent ; 
  123.     appendtovlist ( justbox ) ; 
  124.     if ( memtop - 5 != adjusttail ) 
  125.     {
  126.       mem [ curlist .tailfield ] .hh .v.RH = mem [ memtop - 5 ] .hh .v.RH ; 
  127.       curlist .tailfield = adjusttail ; 
  128.     } 
  129.     adjusttail = 0 ; 
  130.     if ( curline + 1 != bestline ) 
  131.     {
  132.       pen = eqtb [ 6176 ] .cint ; 
  133.       if ( curline == curlist .pgfield + 1 ) 
  134.       pen = pen + eqtb [ 6168 ] .cint ; 
  135.       if ( curline + 2 == bestline ) 
  136.       pen = pen + finalwidowpenalty ; 
  137.       if ( discbreak ) 
  138.       pen = pen + eqtb [ 6171 ] .cint ; 
  139.       if ( pen != 0 ) 
  140.       {
  141.     r = newpenalty ( pen ) ; 
  142.     mem [ curlist .tailfield ] .hh .v.RH = r ; 
  143.     curlist .tailfield = r ; 
  144.       } 
  145.     } 
  146.     incr ( curline ) ; 
  147.     curp = mem [ curp + 1 ] .hh .v.LH ; 
  148.     if ( curp != 0 ) 
  149.     if ( ! postdiscbreak ) 
  150.     {
  151.       r = memtop - 3 ; 
  152.       while ( true ) {
  153.       
  154.     q = mem [ r ] .hh .v.RH ; 
  155.     if ( q == mem [ curp + 1 ] .hh .v.RH ) 
  156.     goto lab31 ; 
  157.     if ( ( q >= himemmin ) ) 
  158.     goto lab31 ; 
  159.     if ( ( mem [ q ] .hh.b0 < 9 ) ) 
  160.     goto lab31 ; 
  161.     if ( mem [ q ] .hh.b1 == 2 ) 
  162.     if ( mem [ q ] .hh.b0 == 11 ) 
  163.     goto lab31 ; 
  164.     r = q ; 
  165.       } 
  166.       lab31: if ( r != memtop - 3 ) 
  167.       {
  168.     mem [ r ] .hh .v.RH = 0 ; 
  169.     flushnodelist ( mem [ memtop - 3 ] .hh .v.RH ) ; 
  170.     mem [ memtop - 3 ] .hh .v.RH = q ; 
  171.       } 
  172.     } 
  173.   } while ( ! ( curp == 0 ) ) ; 
  174.   if ( ( curline != bestline ) || ( mem [ memtop - 3 ] .hh .v.RH != 0 ) ) 
  175.   confusion ( 932 ) ; 
  176.   curlist .pgfield = bestline - 1 ; 
  177. smallnumber zreconstitute ( j , n , bchar , hchar ) 
  178. smallnumber j ; 
  179. smallnumber n ; 
  180. halfword bchar ; 
  181. halfword hchar ; 
  182. {/* 22 30 */ register smallnumber Result; reconstitute_regmem 
  183.   halfword p  ; 
  184.   halfword t  ; 
  185.   fourquarters q  ; 
  186.   halfword currh  ; 
  187.   halfword testchar  ; 
  188.   scaled w  ; 
  189.   fontindex k  ; 
  190.   hyphenpassed = 0 ; 
  191.   t = memtop - 4 ; 
  192.   w = 0 ; 
  193.   mem [ memtop - 4 ] .hh .v.RH = 0 ; 
  194.   curl = hu [ j ] ; 
  195.   curq = t ; 
  196.   if ( j == 0 ) 
  197.   {
  198.     ligaturepresent = initlig ; 
  199.     p = initlist ; 
  200.     if ( ligaturepresent ) 
  201.     lfthit = initlft ; 
  202.     while ( p > 0 ) {
  203.     
  204.       {
  205.     mem [ t ] .hh .v.RH = getavail () ; 
  206.     t = mem [ t ] .hh .v.RH ; 
  207.     mem [ t ] .hh.b0 = hf ; 
  208.     mem [ t ] .hh.b1 = mem [ p ] .hh.b1 ; 
  209.       } 
  210.       p = mem [ p ] .hh .v.RH ; 
  211.     } 
  212.   } 
  213.   else if ( curl < 256 ) 
  214.   {
  215.     mem [ t ] .hh .v.RH = getavail () ; 
  216.     t = mem [ t ] .hh .v.RH ; 
  217.     mem [ t ] .hh.b0 = hf ; 
  218.     mem [ t ] .hh.b1 = curl ; 
  219.   } 
  220.   ligstack = 0 ; 
  221.   {
  222.     if ( j < n ) 
  223.     curr = hu [ j + 1 ] ; 
  224.     else curr = bchar ; 
  225.     if ( odd ( hyf [ j ] ) ) 
  226.     currh = hchar ; 
  227.     else currh = 256 ; 
  228.   } 
  229.   lab22: if ( curl == 256 ) 
  230.   {
  231.     k = bcharlabel [ hf ] ; 
  232.     if ( k == fontmemsize ) 
  233.     goto lab30 ; 
  234.     else q = fontinfo [ k ] .qqqq ; 
  235.   } 
  236.   else {
  237.       
  238.     q = fontinfo [ charbase [ hf ] + curl ] .qqqq ; 
  239.     if ( ( ( q .b2 ) % 4 ) != 1 ) 
  240.     goto lab30 ; 
  241.     k = ligkernbase [ hf ] + q .b3 ; 
  242.     q = fontinfo [ k ] .qqqq ; 
  243.     if ( q .b0 > 128 ) 
  244.     {
  245.       k = ligkernbase [ hf ] + 256 * q .b2 + q .b3 + 32768L - 256 * ( 128 ) ; 
  246.       q = fontinfo [ k ] .qqqq ; 
  247.     } 
  248.   } 
  249.   if ( currh < 256 ) 
  250.   testchar = currh ; 
  251.   else testchar = curr ; 
  252.   while ( true ) {
  253.       
  254.     if ( q .b1 == testchar ) 
  255.     if ( q .b0 <= 128 ) 
  256.     if ( currh < 256 ) 
  257.     {
  258.       hyphenpassed = j ; 
  259.       hchar = 256 ; 
  260.       currh = 256 ; 
  261.       goto lab22 ; 
  262.     } 
  263.     else {
  264.     
  265.       if ( hchar < 256 ) 
  266.       if ( odd ( hyf [ j ] ) ) 
  267.       {
  268.     hyphenpassed = j ; 
  269.     hchar = 256 ; 
  270.       } 
  271.       if ( q .b2 < 128 ) 
  272.       {
  273.     if ( curl == 256 ) 
  274.     lfthit = true ; 
  275.     if ( j == n ) 
  276.     if ( ligstack == 0 ) 
  277.     rthit = true ; 
  278.     {
  279.       if ( interrupt != 0 ) 
  280.       pauseforinstructions () ; 
  281.     } 
  282.     switch ( q .b2 ) 
  283.     {case 1 : 
  284.     case 5 : 
  285.       {
  286.         curl = q .b3 ; 
  287.         ligaturepresent = true ; 
  288.       } 
  289.       break ; 
  290.     case 2 : 
  291.     case 6 : 
  292.       {
  293.         curr = q .b3 ; 
  294.         if ( ligstack > 0 ) 
  295.         mem [ ligstack ] .hh.b1 = curr ; 
  296.         else {
  297.         
  298.           ligstack = newligitem ( curr ) ; 
  299.           if ( j == n ) 
  300.           bchar = 256 ; 
  301.           else {
  302.           
  303.         p = getavail () ; 
  304.         mem [ ligstack + 1 ] .hh .v.RH = p ; 
  305.         mem [ p ] .hh.b1 = hu [ j + 1 ] ; 
  306.         mem [ p ] .hh.b0 = hf ; 
  307.           } 
  308.         } 
  309.       } 
  310.       break ; 
  311.     case 3 : 
  312.       {
  313.         curr = q .b3 ; 
  314.         p = ligstack ; 
  315.         ligstack = newligitem ( curr ) ; 
  316.         mem [ ligstack ] .hh .v.RH = p ; 
  317.       } 
  318.       break ; 
  319.     case 7 : 
  320.     case 11 : 
  321.       {
  322.         if ( ligaturepresent ) 
  323.         {
  324.           p = newligature ( hf , curl , mem [ curq ] .hh .v.RH ) ; 
  325.           if ( lfthit ) 
  326.           {
  327.         mem [ p ] .hh.b1 = 2 ; 
  328.         lfthit = false ; 
  329.           } 
  330.           if ( false ) 
  331.           if ( ligstack == 0 ) 
  332.           {
  333.         incr ( mem [ p ] .hh.b1 ) ; 
  334.         rthit = false ; 
  335.           } 
  336.           mem [ curq ] .hh .v.RH = p ; 
  337.           t = p ; 
  338.           ligaturepresent = false ; 
  339.         } 
  340.         curq = t ; 
  341.         curl = q .b3 ; 
  342.         ligaturepresent = true ; 
  343.       } 
  344.       break ; 
  345.       default: 
  346.       {
  347.         curl = q .b3 ; 
  348.         ligaturepresent = true ; 
  349.         if ( ligstack > 0 ) 
  350.         {
  351.           if ( mem [ ligstack + 1 ] .hh .v.RH > 0 ) 
  352.           {
  353.         mem [ t ] .hh .v.RH = mem [ ligstack + 1 ] .hh .v.RH ; 
  354.         t = mem [ t ] .hh .v.RH ; 
  355.         incr ( j ) ; 
  356.           } 
  357.           p = ligstack ; 
  358.           ligstack = mem [ p ] .hh .v.RH ; 
  359.           freenode ( p , 2 ) ; 
  360.           if ( ligstack == 0 ) 
  361.           {
  362.         if ( j < n ) 
  363.         curr = hu [ j + 1 ] ; 
  364.         else curr = bchar ; 
  365.         if ( odd ( hyf [ j ] ) ) 
  366.         currh = hchar ; 
  367.         else currh = 256 ; 
  368.           } 
  369.           else curr = mem [ ligstack ] .hh.b1 ; 
  370.         } 
  371.         else if ( j == n ) 
  372.         goto lab30 ; 
  373.         else {
  374.         
  375.           {
  376.         mem [ t ] .hh .v.RH = getavail () ; 
  377.         t = mem [ t ] .hh .v.RH ; 
  378.         mem [ t ] .hh.b0 = hf ; 
  379.         mem [ t ] .hh.b1 = curr ; 
  380.           } 
  381.           incr ( j ) ; 
  382.           {
  383.         if ( j < n ) 
  384.         curr = hu [ j + 1 ] ; 
  385.         else curr = bchar ; 
  386.         if ( odd ( hyf [ j ] ) ) 
  387.         currh = hchar ; 
  388.         else currh = 256 ; 
  389.           } 
  390.         } 
  391.       } 
  392.       break ; 
  393.     } 
  394.     if ( q .b2 > 4 ) 
  395.     if ( q .b2 != 7 ) 
  396.     goto lab30 ; 
  397.     goto lab22 ; 
  398.       } 
  399.       w = fontinfo [ kernbase [ hf ] + 256 * q .b2 + q .b3 ] .cint ; 
  400.       goto lab30 ; 
  401.     } 
  402.     if ( q .b0 >= 128 ) 
  403.     if ( currh == 256 ) 
  404.     goto lab30 ; 
  405.     else {
  406.     
  407.       currh = 256 ; 
  408.       goto lab22 ; 
  409.     } 
  410.     k = k + q .b0 + 1 ; 
  411.     q = fontinfo [ k ] .qqqq ; 
  412.   } 
  413.   lab30: ; 
  414.   if ( ligaturepresent ) 
  415.   {
  416.     p = newligature ( hf , curl , mem [ curq ] .hh .v.RH ) ; 
  417.     if ( lfthit ) 
  418.     {
  419.       mem [ p ] .hh.b1 = 2 ; 
  420.       lfthit = false ; 
  421.     } 
  422.     if ( rthit ) 
  423.     if ( ligstack == 0 ) 
  424.     {
  425.       incr ( mem [ p ] .hh.b1 ) ; 
  426.       rthit = false ; 
  427.     } 
  428.     mem [ curq ] .hh .v.RH = p ; 
  429.     t = p ; 
  430.     ligaturepresent = false ; 
  431.   } 
  432.   if ( w != 0 ) 
  433.   {
  434.     mem [ t ] .hh .v.RH = newkern ( w ) ; 
  435.     t = mem [ t ] .hh .v.RH ; 
  436.     w = 0 ; 
  437.   } 
  438.   if ( ligstack > 0 ) 
  439.   {
  440.     curq = t ; 
  441.     curl = mem [ ligstack ] .hh.b1 ; 
  442.     ligaturepresent = true ; 
  443.     {
  444.       if ( mem [ ligstack + 1 ] .hh .v.RH > 0 ) 
  445.       {
  446.     mem [ t ] .hh .v.RH = mem [ ligstack + 1 ] .hh .v.RH ; 
  447.     t = mem [ t ] .hh .v.RH ; 
  448.     incr ( j ) ; 
  449.       } 
  450.       p = ligstack ; 
  451.       ligstack = mem [ p ] .hh .v.RH ; 
  452.       freenode ( p , 2 ) ; 
  453.       if ( ligstack == 0 ) 
  454.       {
  455.     if ( j < n ) 
  456.     curr = hu [ j + 1 ] ; 
  457.     else curr = bchar ; 
  458.     if ( odd ( hyf [ j ] ) ) 
  459.     currh = hchar ; 
  460.     else currh = 256 ; 
  461.       } 
  462.       else curr = mem [ ligstack ] .hh.b1 ; 
  463.     } 
  464.     goto lab22 ; 
  465.   } 
  466.   Result = j ; 
  467.   return(Result) ; 
  468. void hyphenate ( ) 
  469. {/* 50 30 40 41 42 45 10 */ hyphenate_regmem 
  470.   schar i, j, l  ; 
  471.   halfword q, r, s  ; 
  472.   halfword bchar  ; 
  473.   halfword majortail, minortail  ; 
  474.   ASCIIcode c  ; 
  475.   schar cloc  ; 
  476.   integer rcount  ; 
  477.   halfword hyfnode  ; 
  478.   triepointer z  ; 
  479.   integer v  ; 
  480.   hyphpointer h  ; 
  481.   strnumber k  ; 
  482.   poolpointer u  ; 
  483.   {register integer for_end; j = 0 ; for_end = hn ; if ( j <= for_end) do 
  484.     hyf [ j ] = 0 ; 
  485.   while ( j++ < for_end ) ; } 
  486.   h = hc [ 1 ] ; 
  487.   incr ( hn ) ; 
  488.   hc [ hn ] = curlang ; 
  489.   {register integer for_end; j = 2 ; for_end = hn ; if ( j <= for_end) do 
  490.     h = ( h + h + hc [ j ] ) % 307 ; 
  491.   while ( j++ < for_end ) ; } 
  492.   while ( true ) {
  493.       
  494.     k = hyphword [ h ] ; 
  495.     if ( k == 0 ) 
  496.     goto lab45 ; 
  497.     if ( ( strstart [ k + 1 ] - strstart [ k ] ) < hn ) 
  498.     goto lab45 ; 
  499.     if ( ( strstart [ k + 1 ] - strstart [ k ] ) == hn ) 
  500.     {
  501.       j = 1 ; 
  502.       u = strstart [ k ] ; 
  503.       do {
  504.       if ( strpool [ u ] < hc [ j ] ) 
  505.     goto lab45 ; 
  506.     if ( strpool [ u ] > hc [ j ] ) 
  507.     goto lab30 ; 
  508.     incr ( j ) ; 
  509.     incr ( u ) ; 
  510.       } while ( ! ( j > hn ) ) ; 
  511.       s = hyphlist [ h ] ; 
  512.       while ( s != 0 ) {
  513.       
  514.     hyf [ mem [ s ] .hh .v.LH ] = 1 ; 
  515.     s = mem [ s ] .hh .v.RH ; 
  516.       } 
  517.       decr ( hn ) ; 
  518.       goto lab40 ; 
  519.     } 
  520.     lab30: ; 
  521.     if ( h > 0 ) 
  522.     decr ( h ) ; 
  523.     else h = 307 ; 
  524.   } 
  525.   lab45: decr ( hn ) ; 
  526.   if ( trietrc [ curlang + 1 ] != curlang ) 
  527.   return ; 
  528.   hc [ 0 ] = 0 ; 
  529.   hc [ hn + 1 ] = 0 ; 
  530.   hc [ hn + 2 ] = 256 ; 
  531.   {register integer for_end; j = 0 ; for_end = hn - rhyf + 1 ; if ( j <= 
  532.   for_end) do 
  533.     {
  534.       z = trietrl [ curlang + 1 ] + hc [ j ] ; 
  535.       l = j ; 
  536.       while ( hc [ l ] == trietrc [ z ] ) {
  537.       
  538.     if ( trietro [ z ] != mintrieop ) 
  539.     {
  540.       v = trietro [ z ] ; 
  541.       do {
  542.           v = v + opstart [ curlang ] ; 
  543.         i = l - hyfdistance [ v ] ; 
  544.         if ( hyfnum [ v ] > hyf [ i ] ) 
  545.         hyf [ i ] = hyfnum [ v ] ; 
  546.         v = hyfnext [ v ] ; 
  547.       } while ( ! ( v == mintrieop ) ) ; 
  548.     } 
  549.     incr ( l ) ; 
  550.     z = trietrl [ z ] + hc [ l ] ; 
  551.       } 
  552.     } 
  553.   while ( j++ < for_end ) ; } 
  554.   lab40: {
  555.       register integer for_end; j = 0 ; for_end = lhyf - 1 ; if ( j <= 
  556.   for_end) do 
  557.     hyf [ j ] = 0 ; 
  558.   while ( j++ < for_end ) ; } 
  559.   {register integer for_end; j = 0 ; for_end = rhyf - 1 ; if ( j <= for_end) 
  560.   do 
  561.     hyf [ hn - j ] = 0 ; 
  562.   while ( j++ < for_end ) ; } 
  563.   {register integer for_end; j = lhyf ; for_end = hn - rhyf ; if ( j <= 
  564.   for_end) do 
  565.     if ( odd ( hyf [ j ] ) ) 
  566.     goto lab41 ; 
  567.   while ( j++ < for_end ) ; } 
  568.   return ; 
  569.   lab41: ; 
  570.   q = mem [ hb ] .hh .v.RH ; 
  571.   mem [ hb ] .hh .v.RH = 0 ; 
  572.   r = mem [ ha ] .hh .v.RH ; 
  573.   mem [ ha ] .hh .v.RH = 0 ; 
  574.   bchar = 256 ; 
  575.   if ( ! ( hb >= himemmin ) ) 
  576.   if ( mem [ hb ] .hh.b0 == 6 ) 
  577.   if ( odd ( mem [ hb ] .hh.b1 ) ) 
  578.   bchar = fontbchar [ hf ] ; 
  579.   if ( ( ha >= himemmin ) ) 
  580.   if ( mem [ ha ] .hh.b0 != hf ) 
  581.   goto lab42 ; 
  582.   else {
  583.       
  584.     initlist = ha ; 
  585.     initlig = false ; 
  586.     hu [ 0 ] = mem [ ha ] .hh.b1 ; 
  587.   } 
  588.   else if ( mem [ ha ] .hh.b0 == 6 ) 
  589.   if ( mem [ ha + 1 ] .hh.b0 != hf ) 
  590.   goto lab42 ; 
  591.   else {
  592.       
  593.     initlist = mem [ ha + 1 ] .hh .v.RH ; 
  594.     initlig = true ; 
  595.     initlft = ( mem [ ha ] .hh.b1 > 1 ) ; 
  596.     hu [ 0 ] = mem [ ha + 1 ] .hh.b1 ; 
  597.     if ( initlist == 0 ) 
  598.     if ( initlft ) 
  599.     {
  600.       hu [ 0 ] = 256 ; 
  601.       initlig = false ; 
  602.     } 
  603.     freenode ( ha , 2 ) ; 
  604.   } 
  605.   else {
  606.       
  607.     if ( ! ( r >= himemmin ) ) 
  608.     if ( mem [ r ] .hh.b0 == 6 ) 
  609.     if ( mem [ r ] .hh.b1 > 1 ) 
  610.     goto lab42 ; 
  611.     j = 1 ; 
  612.     s = ha ; 
  613.     initlist = 0 ; 
  614.     goto lab50 ; 
  615.   } 
  616.   s = curp ; 
  617.   while ( mem [ s ] .hh .v.RH != ha ) s = mem [ s ] .hh .v.RH ; 
  618.   j = 0 ; 
  619.   goto lab50 ; 
  620.   lab42: s = ha ; 
  621.   j = 0 ; 
  622.   hu [ 0 ] = 256 ; 
  623.   initlig = false ; 
  624.   initlist = 0 ; 
  625.   lab50: flushnodelist ( r ) ; 
  626.   do {
  627.       l = j ; 
  628.     j = reconstitute ( j , hn , bchar , hyfchar ) + 1 ; 
  629.     if ( hyphenpassed == 0 ) 
  630.     {
  631.       mem [ s ] .hh .v.RH = mem [ memtop - 4 ] .hh .v.RH ; 
  632.       while ( mem [ s ] .hh .v.RH > 0 ) s = mem [ s ] .hh .v.RH ; 
  633.       if ( odd ( hyf [ j - 1 ] ) ) 
  634.       {
  635.     l = j ; 
  636.     hyphenpassed = j - 1 ; 
  637.     mem [ memtop - 4 ] .hh .v.RH = 0 ; 
  638.       } 
  639.     } 
  640.     if ( hyphenpassed > 0 ) 
  641.     do {
  642.     r = getnode ( 2 ) ; 
  643.       mem [ r ] .hh .v.RH = mem [ memtop - 4 ] .hh .v.RH ; 
  644.       mem [ r ] .hh.b0 = 7 ; 
  645.       majortail = r ; 
  646.       rcount = 0 ; 
  647.       while ( mem [ majortail ] .hh .v.RH > 0 ) {
  648.       
  649.     majortail = mem [ majortail ] .hh .v.RH ; 
  650.     incr ( rcount ) ; 
  651.       } 
  652.       i = hyphenpassed ; 
  653.       hyf [ i ] = 0 ; 
  654.       minortail = 0 ; 
  655.       mem [ r + 1 ] .hh .v.LH = 0 ; 
  656.       hyfnode = newcharacter ( hf , hyfchar ) ; 
  657.       if ( hyfnode != 0 ) 
  658.       {
  659.     incr ( i ) ; 
  660.     c = hu [ i ] ; 
  661.     hu [ i ] = hyfchar ; 
  662.     {
  663.       mem [ hyfnode ] .hh .v.RH = avail ; 
  664.       avail = hyfnode ; 
  665.     ;
  666. #ifdef STAT
  667.       decr ( dynused ) ; 
  668. #endif /* STAT */
  669.     } 
  670.       } 
  671.       while ( l <= i ) {
  672.       
  673.     l = reconstitute ( l , i , fontbchar [ hf ] , 256 ) + 1 ; 
  674.     if ( mem [ memtop - 4 ] .hh .v.RH > 0 ) 
  675.     {
  676.       if ( minortail == 0 ) 
  677.       mem [ r + 1 ] .hh .v.LH = mem [ memtop - 4 ] .hh .v.RH ; 
  678.       else mem [ minortail ] .hh .v.RH = mem [ memtop - 4 ] .hh .v.RH ; 
  679.       minortail = mem [ memtop - 4 ] .hh .v.RH ; 
  680.       while ( mem [ minortail ] .hh .v.RH > 0 ) minortail = mem [ 
  681.       minortail ] .hh .v.RH ; 
  682.     } 
  683.       } 
  684.       if ( hyfnode != 0 ) 
  685.       {
  686.     hu [ i ] = c ; 
  687.     l = i ; 
  688.     decr ( i ) ; 
  689.       } 
  690.       minortail = 0 ; 
  691.       mem [ r + 1 ] .hh .v.RH = 0 ; 
  692.       cloc = 0 ; 
  693.       if ( bcharlabel [ hf ] < fontmemsize ) 
  694.       {
  695.     decr ( l ) ; 
  696.     c = hu [ l ] ; 
  697.     cloc = l ; 
  698.     hu [ l ] = 256 ; 
  699.       } 
  700.       while ( l < j ) {
  701.       
  702.     do {
  703.         l = reconstitute ( l , hn , bchar , 256 ) + 1 ; 
  704.       if ( cloc > 0 ) 
  705.       {
  706.         hu [ cloc ] = c ; 
  707.         cloc = 0 ; 
  708.       } 
  709.       if ( mem [ memtop - 4 ] .hh .v.RH > 0 ) 
  710.       {
  711.         if ( minortail == 0 ) 
  712.         mem [ r + 1 ] .hh .v.RH = mem [ memtop - 4 ] .hh .v.RH ; 
  713.         else mem [ minortail ] .hh .v.RH = mem [ memtop - 4 ] .hh .v.RH ; 
  714.         minortail = mem [ memtop - 4 ] .hh .v.RH ; 
  715.         while ( mem [ minortail ] .hh .v.RH > 0 ) minortail = mem [ 
  716.         minortail ] .hh .v.RH ; 
  717.       } 
  718.     } while ( ! ( l >= j ) ) ; 
  719.     while ( l > j ) {
  720.         
  721.       j = reconstitute ( j , hn , bchar , 256 ) + 1 ; 
  722.       mem [ majortail ] .hh .v.RH = mem [ memtop - 4 ] .hh .v.RH ; 
  723.       while ( mem [ majortail ] .hh .v.RH > 0 ) {
  724.           
  725.         majortail = mem [ majortail ] .hh .v.RH ; 
  726.         incr ( rcount ) ; 
  727.       } 
  728.     } 
  729.       } 
  730.       if ( rcount > 127 ) 
  731.       {
  732.     mem [ s ] .hh .v.RH = mem [ r ] .hh .v.RH ; 
  733.     mem [ r ] .hh .v.RH = 0 ; 
  734.     flushnodelist ( r ) ; 
  735.       } 
  736.       else {
  737.       
  738.     mem [ s ] .hh .v.RH = r ; 
  739.     mem [ r ] .hh.b1 = rcount ; 
  740.       } 
  741.       s = majortail ; 
  742.       hyphenpassed = j - 1 ; 
  743.       mem [ memtop - 4 ] .hh .v.RH = 0 ; 
  744.     } while ( ! ( ! odd ( hyf [ j - 1 ] ) ) ) ; 
  745.   } while ( ! ( j > hn ) ) ; 
  746.   mem [ s ] .hh .v.RH = q ; 
  747.   flushlist ( initlist ) ; 
  748. void newhyphexceptions ( ) 
  749. {/* 21 10 40 45 */ newhyphexceptions_regmem 
  750.   smallnumber n  ; 
  751.   smallnumber j  ; 
  752.   hyphpointer h  ; 
  753.   strnumber k  ; 
  754.   halfword p  ; 
  755.   halfword q  ; 
  756.   strnumber s, t  ; 
  757.   poolpointer u, v  ; 
  758.   scanleftbrace () ; 
  759.   if ( eqtb [ 6213 ] .cint <= 0 ) 
  760.   curlang = 0 ; 
  761.   else if ( eqtb [ 6213 ] .cint > 255 ) 
  762.   curlang = 0 ; 
  763.   else curlang = eqtb [ 6213 ] .cint ; 
  764.   n = 0 ; 
  765.   p = 0 ; 
  766.   while ( true ) {
  767.       
  768.     getxtoken () ; 
  769.     lab21: switch ( curcmd ) 
  770.     {case 11 : 
  771.     case 12 : 
  772.     case 68 : 
  773.       if ( curchr == 45 ) 
  774.       {
  775.     if ( n < 63 ) 
  776.     {
  777.       q = getavail () ; 
  778.       mem [ q ] .hh .v.RH = p ; 
  779.       mem [ q ] .hh .v.LH = n ; 
  780.       p = q ; 
  781.     } 
  782.       } 
  783.       else {
  784.       
  785.     if ( eqtb [ 5139 + curchr ] .hh .v.RH == 0 ) 
  786.     {
  787.       {
  788.         if ( interaction == 3 ) 
  789.         wakeupterminal () ; 
  790.         printnl ( 262 ) ; 
  791.         print ( 938 ) ; 
  792.       } 
  793.       {
  794.         helpptr = 2 ; 
  795.         helpline [ 1 ] = 939 ; 
  796.         helpline [ 0 ] = 940 ; 
  797.       } 
  798.       error () ; 
  799.     } 
  800.     else if ( n < 63 ) 
  801.     {
  802.       incr ( n ) ; 
  803.       hc [ n ] = eqtb [ 5139 + curchr ] .hh .v.RH ; 
  804.     } 
  805.       } 
  806.       break ; 
  807.     case 16 : 
  808.       {
  809.     scancharnum () ; 
  810.     curchr = curval ; 
  811.     curcmd = 68 ; 
  812.     goto lab21 ; 
  813.       } 
  814.       break ; 
  815.     case 10 : 
  816.     case 2 : 
  817.       {
  818.     if ( n > 1 ) 
  819.     {
  820.       incr ( n ) ; 
  821.       hc [ n ] = curlang ; 
  822.       {
  823.         if ( poolptr + n > poolsize ) 
  824.         overflow ( 257 , poolsize - initpoolptr ) ; 
  825.       } 
  826.       h = 0 ; 
  827.       {register integer for_end; j = 1 ; for_end = n ; if ( j <= for_end) 
  828.       do 
  829.         {
  830.           h = ( h + h + hc [ j ] ) % 307 ; 
  831.           {
  832.         strpool [ poolptr ] = hc [ j ] ; 
  833.         incr ( poolptr ) ; 
  834.           } 
  835.         } 
  836.       while ( j++ < for_end ) ; } 
  837.       s = makestring () ; 
  838.       if ( hyphcount == 307 ) 
  839.       overflow ( 941 , 307 ) ; 
  840.       incr ( hyphcount ) ; 
  841.       while ( hyphword [ h ] != 0 ) {
  842.           
  843.         k = hyphword [ h ] ; 
  844.         if ( ( strstart [ k + 1 ] - strstart [ k ] ) < ( strstart [ s + 1 
  845.         ] - strstart [ s ] ) ) 
  846.         goto lab40 ; 
  847.         if ( ( strstart [ k + 1 ] - strstart [ k ] ) > ( strstart [ s + 1 
  848.         ] - strstart [ s ] ) ) 
  849.         goto lab45 ; 
  850.         u = strstart [ k ] ; 
  851.         v = strstart [ s ] ; 
  852.         do {
  853.         if ( strpool [ u ] < strpool [ v ] ) 
  854.           goto lab40 ; 
  855.           if ( strpool [ u ] > strpool [ v ] ) 
  856.           goto lab45 ; 
  857.           incr ( u ) ; 
  858.           incr ( v ) ; 
  859.         } while ( ! ( u == strstart [ k + 1 ] ) ) ; 
  860.         lab40: q = hyphlist [ h ] ; 
  861.         hyphlist [ h ] = p ; 
  862.         p = q ; 
  863.         t = hyphword [ h ] ; 
  864.         hyphword [ h ] = s ; 
  865.         s = t ; 
  866.         lab45: ; 
  867.         if ( h > 0 ) 
  868.         decr ( h ) ; 
  869.         else h = 307 ; 
  870.       } 
  871.       hyphword [ h ] = s ; 
  872.       hyphlist [ h ] = p ; 
  873.     } 
  874.     if ( curcmd == 2 ) 
  875.     return ; 
  876.     n = 0 ; 
  877.     p = 0 ; 
  878.       } 
  879.       break ; 
  880.       default: 
  881.       {
  882.     {
  883.       if ( interaction == 3 ) 
  884.       wakeupterminal () ; 
  885.       printnl ( 262 ) ; 
  886.       print ( 676 ) ; 
  887.     } 
  888.     printesc ( 934 ) ; 
  889.     print ( 935 ) ; 
  890.     {
  891.       helpptr = 2 ; 
  892.       helpline [ 1 ] = 936 ; 
  893.       helpline [ 0 ] = 937 ; 
  894.     } 
  895.     error () ; 
  896.       } 
  897.       break ; 
  898.     } 
  899.   } 
  900. halfword zprunepagetop ( p ) 
  901. halfword p ; 
  902. {register halfword Result; prunepagetop_regmem 
  903.   halfword prevp  ; 
  904.   halfword q  ; 
  905.   prevp = memtop - 3 ; 
  906.   mem [ memtop - 3 ] .hh .v.RH = p ; 
  907.   while ( p != 0 ) switch ( mem [ p ] .hh.b0 ) 
  908.   {case 0 : 
  909.   case 1 : 
  910.   case 2 : 
  911.     {
  912.       q = newskipparam ( 10 ) ; 
  913.       mem [ prevp ] .hh .v.RH = q ; 
  914.       mem [ q ] .hh .v.RH = p ; 
  915.       if ( mem [ tempptr + 1 ] .cint > mem [ p + 3 ] .cint ) 
  916.       mem [ tempptr + 1 ] .cint = mem [ tempptr + 1 ] .cint - mem [ p + 3 ] 
  917.       .cint ; 
  918.       else mem [ tempptr + 1 ] .cint = 0 ; 
  919.       p = 0 ; 
  920.     } 
  921.     break ; 
  922.   case 8 : 
  923.   case 4 : 
  924.   case 3 : 
  925.     {
  926.       prevp = p ; 
  927.       p = mem [ prevp ] .hh .v.RH ; 
  928.     } 
  929.     break ; 
  930.   case 10 : 
  931.   case 11 : 
  932.   case 12 : 
  933.     {
  934.       q = p ; 
  935.       p = mem [ q ] .hh .v.RH ; 
  936.       mem [ q ] .hh .v.RH = 0 ; 
  937.       mem [ prevp ] .hh .v.RH = p ; 
  938.       flushnodelist ( q ) ; 
  939.     } 
  940.     break ; 
  941.     default: 
  942.     confusion ( 952 ) ; 
  943.     break ; 
  944.   } 
  945.   Result = mem [ memtop - 3 ] .hh .v.RH ; 
  946.   return(Result) ; 
  947. halfword zvertbreak ( p , h , d ) 
  948. halfword p ; 
  949. scaled h ; 
  950. scaled d ; 
  951. {/* 30 45 90 */ register halfword Result; vertbreak_regmem 
  952.   halfword prevp  ; 
  953.   halfword q, r  ; 
  954.   integer pi  ; 
  955.   integer b  ; 
  956.   integer leastcost  ; 
  957.   halfword bestplace  ; 
  958.   scaled prevdp  ; 
  959.   smallnumber t  ; 
  960.   prevp = p ; 
  961.   leastcost = 1073741823L ; 
  962.   activewidth [ 1 ] = 0 ; 
  963.   activewidth [ 2 ] = 0 ; 
  964.   activewidth [ 3 ] = 0 ; 
  965.   activewidth [ 4 ] = 0 ; 
  966.   activewidth [ 5 ] = 0 ; 
  967.   activewidth [ 6 ] = 0 ; 
  968.   prevdp = 0 ; 
  969.   while ( true ) {
  970.       
  971.     if ( p == 0 ) 
  972.     pi = -10000 ; 
  973.     else switch ( mem [ p ] .hh.b0 ) 
  974.     {case 0 : 
  975.     case 1 : 
  976.     case 2 : 
  977.       {
  978.     activewidth [ 1 ] = activewidth [ 1 ] + prevdp + mem [ p + 3 ] .cint ; 
  979.     prevdp = mem [ p + 2 ] .cint ; 
  980.     goto lab45 ; 
  981.       } 
  982.       break ; 
  983.     case 8 : 
  984.       goto lab45 ; 
  985.       break ; 
  986.     case 10 : 
  987.       if ( ( mem [ prevp ] .hh.b0 < 9 ) ) 
  988.       pi = 0 ; 
  989.       else goto lab90 ; 
  990.       break ; 
  991.     case 11 : 
  992.       {
  993.     if ( mem [ p ] .hh .v.RH == 0 ) 
  994.     t = 12 ; 
  995.     else t = mem [ mem [ p ] .hh .v.RH ] .hh.b0 ; 
  996.     if ( t == 10 ) 
  997.     pi = 0 ; 
  998.     else goto lab90 ; 
  999.       } 
  1000.       break ; 
  1001.     case 12 : 
  1002.       pi = mem [ p + 1 ] .cint ; 
  1003.       break ; 
  1004.     case 4 : 
  1005.     case 3 : 
  1006.       goto lab45 ; 
  1007.       break ; 
  1008.       default: 
  1009.       confusion ( 953 ) ; 
  1010.       break ; 
  1011.     } 
  1012.     if ( pi < 10000 ) 
  1013.     {
  1014.       if ( activewidth [ 1 ] < h ) 
  1015.       if ( ( activewidth [ 3 ] != 0 ) || ( activewidth [ 4 ] != 0 ) || ( 
  1016.       activewidth [ 5 ] != 0 ) ) 
  1017.       b = 0 ; 
  1018.       else b = badness ( h - activewidth [ 1 ] , activewidth [ 2 ] ) ; 
  1019.       else if ( activewidth [ 1 ] - h > activewidth [ 6 ] ) 
  1020.       b = 1073741823L ; 
  1021.       else b = badness ( activewidth [ 1 ] - h , activewidth [ 6 ] ) ; 
  1022.       if ( b < 1073741823L ) 
  1023.       if ( pi <= -10000 ) 
  1024.       b = pi ; 
  1025.       else if ( b < 10000 ) 
  1026.       b = b + pi ; 
  1027.       else b = 100000L ; 
  1028.       if ( b <= leastcost ) 
  1029.       {
  1030.     bestplace = p ; 
  1031.     leastcost = b ; 
  1032.     bestheightplusdepth = activewidth [ 1 ] + prevdp ; 
  1033.       } 
  1034.       if ( ( b == 1073741823L ) || ( pi <= -10000 ) ) 
  1035.       goto lab30 ; 
  1036.     } 
  1037.     if ( ( mem [ p ] .hh.b0 < 10 ) || ( mem [ p ] .hh.b0 > 11 ) ) 
  1038.     goto lab45 ; 
  1039.     lab90: if ( mem [ p ] .hh.b0 == 11 ) 
  1040.     q = p ; 
  1041.     else {
  1042.     
  1043.       q = mem [ p + 1 ] .hh .v.LH ; 
  1044.       activewidth [ 2 + mem [ q ] .hh.b0 ] = activewidth [ 2 + mem [ q ] 
  1045.       .hh.b0 ] + mem [ q + 2 ] .cint ; 
  1046.       activewidth [ 6 ] = activewidth [ 6 ] + mem [ q + 3 ] .cint ; 
  1047.       if ( ( mem [ q ] .hh.b1 != 0 ) && ( mem [ q + 3 ] .cint != 0 ) ) 
  1048.       {
  1049.     {
  1050.       if ( interaction == 3 ) 
  1051.       wakeupterminal () ; 
  1052.       printnl ( 262 ) ; 
  1053.       print ( 954 ) ; 
  1054.     } 
  1055.     {
  1056.       helpptr = 4 ; 
  1057.       helpline [ 3 ] = 955 ; 
  1058.       helpline [ 2 ] = 956 ; 
  1059.       helpline [ 1 ] = 957 ; 
  1060.       helpline [ 0 ] = 915 ; 
  1061.     } 
  1062.     error () ; 
  1063.     r = newspec ( q ) ; 
  1064.     mem [ r ] .hh.b1 = 0 ; 
  1065.     deleteglueref ( q ) ; 
  1066.     mem [ p + 1 ] .hh .v.LH = r ; 
  1067.     q = r ; 
  1068.       } 
  1069.     } 
  1070.     activewidth [ 1 ] = activewidth [ 1 ] + prevdp + mem [ q + 1 ] .cint ; 
  1071.     prevdp = 0 ; 
  1072.     lab45: if ( prevdp > d ) 
  1073.     {
  1074.       activewidth [ 1 ] = activewidth [ 1 ] + prevdp - d ; 
  1075.       prevdp = d ; 
  1076.     } 
  1077.     prevp = p ; 
  1078.     p = mem [ prevp ] .hh .v.RH ; 
  1079.   } 
  1080.   lab30: Result = bestplace ; 
  1081.   return(Result) ; 
  1082.