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

  1. #define EXTERN extern
  2. #include "texd.h"
  3.  
  4. void firmuptheline ( ) 
  5. {firmuptheline_regmem 
  6.   integer k  ; 
  7.   curinput .limitfield = last ; 
  8.   if ( eqtb [ 6191 ] .cint > 0 ) 
  9.   if ( interaction > 1 ) 
  10.   {
  11.     wakeupterminal () ; 
  12.     println () ; 
  13.     if ( curinput .startfield < curinput .limitfield ) 
  14.     {register integer for_end; k = curinput .startfield ; for_end = curinput 
  15.     .limitfield - 1 ; if ( k <= for_end) do 
  16.       print ( buffer [ k ] ) ; 
  17.     while ( k++ < for_end ) ; } 
  18.     first = curinput .limitfield ; 
  19.     {
  20.       wakeupterminal () ; 
  21.       print ( 614 ) ; 
  22.       terminput () ; 
  23.     } 
  24.     if ( last > first ) 
  25.     {
  26.       {register integer for_end; k = first ; for_end = last - 1 ; if ( k <= 
  27.       for_end) do 
  28.     buffer [ k + curinput .startfield - first ] = buffer [ k ] ; 
  29.       while ( k++ < for_end ) ; } 
  30.       curinput .limitfield = curinput .startfield + last - first ; 
  31.     } 
  32.   } 
  33. void gettoken ( ) 
  34. {gettoken_regmem 
  35.   nonewcontrolsequence = false ; 
  36.   getnext () ; 
  37.   nonewcontrolsequence = true ; 
  38.   if ( curcs == 0 ) 
  39.   curtok = ( curcmd * 256 ) + curchr ; 
  40.   else curtok = 4095 + curcs ; 
  41. void macrocall ( ) 
  42. {/* 10 22 30 31 40 */ macrocall_regmem 
  43.   halfword r  ; 
  44.   halfword p  ; 
  45.   halfword q  ; 
  46.   halfword s  ; 
  47.   halfword t  ; 
  48.   halfword u, v  ; 
  49.   halfword rbraceptr  ; 
  50.   smallnumber n  ; 
  51.   halfword unbalance  ; 
  52.   halfword m  ; 
  53.   halfword refcount  ; 
  54.   smallnumber savescannerstatus  ; 
  55.   halfword savewarningindex  ; 
  56.   ASCIIcode matchchr  ; 
  57.   savescannerstatus = scannerstatus ; 
  58.   savewarningindex = warningindex ; 
  59.   warningindex = curcs ; 
  60.   refcount = curchr ; 
  61.   r = mem [ refcount ] .hh .v.RH ; 
  62.   n = 0 ; 
  63.   if ( eqtb [ 6193 ] .cint > 0 ) 
  64.   {
  65.     begindiagnostic () ; 
  66.     println () ; 
  67.     printcs ( warningindex ) ; 
  68.     tokenshow ( refcount ) ; 
  69.     enddiagnostic ( false ) ; 
  70.   } 
  71.   if ( mem [ r ] .hh .v.LH != 3584 ) 
  72.   {
  73.     scannerstatus = 3 ; 
  74.     unbalance = 0 ; 
  75.     longstate = eqtb [ curcs ] .hh.b0 ; 
  76.     if ( longstate >= 113 ) 
  77.     longstate = longstate - 2 ; 
  78.     do {
  79.     mem [ memtop - 3 ] .hh .v.RH = 0 ; 
  80.       if ( ( mem [ r ] .hh .v.LH > 3583 ) || ( mem [ r ] .hh .v.LH < 3328 ) ) 
  81.       s = 0 ; 
  82.       else {
  83.       
  84.     matchchr = mem [ r ] .hh .v.LH - 3328 ; 
  85.     s = mem [ r ] .hh .v.RH ; 
  86.     r = s ; 
  87.     p = memtop - 3 ; 
  88.     m = 0 ; 
  89.       } 
  90.       lab22: gettoken () ; 
  91.       if ( curtok == mem [ r ] .hh .v.LH ) 
  92.       {
  93.     r = mem [ r ] .hh .v.RH ; 
  94.     if ( ( mem [ r ] .hh .v.LH >= 3328 ) && ( mem [ r ] .hh .v.LH <= 3584 
  95.     ) ) 
  96.     {
  97.       if ( curtok < 512 ) 
  98.       decr ( alignstate ) ; 
  99.       goto lab40 ; 
  100.     } 
  101.     else goto lab22 ; 
  102.       } 
  103.       if ( s != r ) 
  104.       if ( s == 0 ) 
  105.       {
  106.     {
  107.       if ( interaction == 3 ) 
  108.       wakeupterminal () ; 
  109.       printnl ( 262 ) ; 
  110.       print ( 646 ) ; 
  111.     } 
  112.     sprintcs ( warningindex ) ; 
  113.     print ( 647 ) ; 
  114.     {
  115.       helpptr = 4 ; 
  116.       helpline [ 3 ] = 648 ; 
  117.       helpline [ 2 ] = 649 ; 
  118.       helpline [ 1 ] = 650 ; 
  119.       helpline [ 0 ] = 651 ; 
  120.     } 
  121.     error () ; 
  122.     goto lab10 ; 
  123.       } 
  124.       else {
  125.       
  126.     t = s ; 
  127.     do {
  128.         { 
  129.         q = getavail () ; 
  130.         mem [ p ] .hh .v.RH = q ; 
  131.         mem [ q ] .hh .v.LH = mem [ t ] .hh .v.LH ; 
  132.         p = q ; 
  133.       } 
  134.       incr ( m ) ; 
  135.       u = mem [ t ] .hh .v.RH ; 
  136.       v = s ; 
  137.       while ( true ) {
  138.           
  139.         if ( u == r ) 
  140.         if ( curtok != mem [ v ] .hh .v.LH ) 
  141.         goto lab30 ; 
  142.         else {
  143.         
  144.           r = mem [ v ] .hh .v.RH ; 
  145.           goto lab22 ; 
  146.         } 
  147.         if ( mem [ u ] .hh .v.LH != mem [ v ] .hh .v.LH ) 
  148.         goto lab30 ; 
  149.         u = mem [ u ] .hh .v.RH ; 
  150.         v = mem [ v ] .hh .v.RH ; 
  151.       } 
  152.       lab30: t = mem [ t ] .hh .v.RH ; 
  153.     } while ( ! ( t == r ) ) ; 
  154.     r = s ; 
  155.       } 
  156.       if ( curtok == partoken ) 
  157.       if ( longstate != 112 ) 
  158.       {
  159.     if ( longstate == 111 ) 
  160.     {
  161.       runaway () ; 
  162.       {
  163.         if ( interaction == 3 ) 
  164.         wakeupterminal () ; 
  165.         printnl ( 262 ) ; 
  166.         print ( 641 ) ; 
  167.       } 
  168.       sprintcs ( warningindex ) ; 
  169.       print ( 642 ) ; 
  170.       {
  171.         helpptr = 3 ; 
  172.         helpline [ 2 ] = 643 ; 
  173.         helpline [ 1 ] = 644 ; 
  174.         helpline [ 0 ] = 645 ; 
  175.       } 
  176.       backerror () ; 
  177.     } 
  178.     pstack [ n ] = mem [ memtop - 3 ] .hh .v.RH ; 
  179.     alignstate = alignstate - unbalance ; 
  180.     {register integer for_end; m = 0 ; for_end = n ; if ( m <= for_end) 
  181.     do 
  182.       flushlist ( pstack [ m ] ) ; 
  183.     while ( m++ < for_end ) ; } 
  184.     goto lab10 ; 
  185.       } 
  186.       if ( curtok < 768 ) 
  187.       if ( curtok < 512 ) 
  188.       {
  189.     unbalance = 1 ; 
  190.     while ( true ) {
  191.         
  192.       {
  193.         {
  194.           q = avail ; 
  195.           if ( q == 0 ) 
  196.           q = getavail () ; 
  197.           else {
  198.           
  199.         avail = mem [ q ] .hh .v.RH ; 
  200.         mem [ q ] .hh .v.RH = 0 ; 
  201.     ;
  202. #ifdef STAT
  203.         incr ( dynused ) ; 
  204. #endif /* STAT */
  205.           } 
  206.         } 
  207.         mem [ p ] .hh .v.RH = q ; 
  208.         mem [ q ] .hh .v.LH = curtok ; 
  209.         p = q ; 
  210.       } 
  211.       gettoken () ; 
  212.       if ( curtok == partoken ) 
  213.       if ( longstate != 112 ) 
  214.       {
  215.         if ( longstate == 111 ) 
  216.         {
  217.           runaway () ; 
  218.           {
  219.         if ( interaction == 3 ) 
  220.         wakeupterminal () ; 
  221.         printnl ( 262 ) ; 
  222.         print ( 641 ) ; 
  223.           } 
  224.           sprintcs ( warningindex ) ; 
  225.           print ( 642 ) ; 
  226.           {
  227.         helpptr = 3 ; 
  228.         helpline [ 2 ] = 643 ; 
  229.         helpline [ 1 ] = 644 ; 
  230.         helpline [ 0 ] = 645 ; 
  231.           } 
  232.           backerror () ; 
  233.         } 
  234.         pstack [ n ] = mem [ memtop - 3 ] .hh .v.RH ; 
  235.         alignstate = alignstate - unbalance ; 
  236.         {register integer for_end; m = 0 ; for_end = n ; if ( m <= 
  237.         for_end) do 
  238.           flushlist ( pstack [ m ] ) ; 
  239.         while ( m++ < for_end ) ; } 
  240.         goto lab10 ; 
  241.       } 
  242.       if ( curtok < 768 ) 
  243.       if ( curtok < 512 ) 
  244.       incr ( unbalance ) ; 
  245.       else {
  246.           
  247.         decr ( unbalance ) ; 
  248.         if ( unbalance == 0 ) 
  249.         goto lab31 ; 
  250.       } 
  251.     } 
  252.     lab31: rbraceptr = p ; 
  253.     {
  254.       q = getavail () ; 
  255.       mem [ p ] .hh .v.RH = q ; 
  256.       mem [ q ] .hh .v.LH = curtok ; 
  257.       p = q ; 
  258.     } 
  259.       } 
  260.       else {
  261.       
  262.     backinput () ; 
  263.     {
  264.       if ( interaction == 3 ) 
  265.       wakeupterminal () ; 
  266.       printnl ( 262 ) ; 
  267.       print ( 633 ) ; 
  268.     } 
  269.     sprintcs ( warningindex ) ; 
  270.     print ( 634 ) ; 
  271.     {
  272.       helpptr = 6 ; 
  273.       helpline [ 5 ] = 635 ; 
  274.       helpline [ 4 ] = 636 ; 
  275.       helpline [ 3 ] = 637 ; 
  276.       helpline [ 2 ] = 638 ; 
  277.       helpline [ 1 ] = 639 ; 
  278.       helpline [ 0 ] = 640 ; 
  279.     } 
  280.     incr ( alignstate ) ; 
  281.     longstate = 111 ; 
  282.     curtok = partoken ; 
  283.     inserror () ; 
  284.       } 
  285.       else {
  286.       
  287.     if ( curtok == 2592 ) 
  288.     if ( mem [ r ] .hh .v.LH <= 3584 ) 
  289.     if ( mem [ r ] .hh .v.LH >= 3328 ) 
  290.     goto lab22 ; 
  291.     {
  292.       q = getavail () ; 
  293.       mem [ p ] .hh .v.RH = q ; 
  294.       mem [ q ] .hh .v.LH = curtok ; 
  295.       p = q ; 
  296.     } 
  297.       } 
  298.       incr ( m ) ; 
  299.       if ( mem [ r ] .hh .v.LH > 3584 ) 
  300.       goto lab22 ; 
  301.       if ( mem [ r ] .hh .v.LH < 3328 ) 
  302.       goto lab22 ; 
  303.       lab40: if ( s != 0 ) 
  304.       {
  305.     if ( ( m == 1 ) && ( mem [ p ] .hh .v.LH < 768 ) && ( p != memtop - 3 
  306.     ) ) 
  307.     {
  308.       mem [ rbraceptr ] .hh .v.RH = 0 ; 
  309.       {
  310.         mem [ p ] .hh .v.RH = avail ; 
  311.         avail = p ; 
  312.     ;
  313. #ifdef STAT
  314.         decr ( dynused ) ; 
  315. #endif /* STAT */
  316.       } 
  317.       p = mem [ memtop - 3 ] .hh .v.RH ; 
  318.       pstack [ n ] = mem [ p ] .hh .v.RH ; 
  319.       {
  320.         mem [ p ] .hh .v.RH = avail ; 
  321.         avail = p ; 
  322.     ;
  323. #ifdef STAT
  324.         decr ( dynused ) ; 
  325. #endif /* STAT */
  326.       } 
  327.     } 
  328.     else pstack [ n ] = mem [ memtop - 3 ] .hh .v.RH ; 
  329.     incr ( n ) ; 
  330.     if ( eqtb [ 6193 ] .cint > 0 ) 
  331.     {
  332.       begindiagnostic () ; 
  333.       printnl ( matchchr ) ; 
  334.       printint ( n ) ; 
  335.       print ( 652 ) ; 
  336.       showtokenlist ( pstack [ n - 1 ] , 0 , 1000 ) ; 
  337.       enddiagnostic ( false ) ; 
  338.     } 
  339.       } 
  340.     } while ( ! ( mem [ r ] .hh .v.LH == 3584 ) ) ; 
  341.   } 
  342.   while ( ( curinput .statefield == 0 ) && ( curinput .locfield == 0 ) ) 
  343.   endtokenlist () ; 
  344.   begintokenlist ( refcount , 5 ) ; 
  345.   curinput .namefield = warningindex ; 
  346.   curinput .locfield = mem [ r ] .hh .v.RH ; 
  347.   if ( n > 0 ) 
  348.   {
  349.     if ( paramptr + n > maxparamstack ) 
  350.     {
  351.       maxparamstack = paramptr + n ; 
  352.       if ( maxparamstack > paramsize ) 
  353.       overflow ( 632 , paramsize ) ; 
  354.     } 
  355.     {register integer for_end; m = 0 ; for_end = n - 1 ; if ( m <= for_end) 
  356.     do 
  357.       paramstack [ paramptr + m ] = pstack [ m ] ; 
  358.     while ( m++ < for_end ) ; } 
  359.     paramptr = paramptr + n ; 
  360.   } 
  361.   lab10: scannerstatus = savescannerstatus ; 
  362.   warningindex = savewarningindex ; 
  363. void insertrelax ( ) 
  364. {insertrelax_regmem 
  365.   curtok = 4095 + curcs ; 
  366.   backinput () ; 
  367.   curtok = 7616 ; 
  368.   backinput () ; 
  369.   curinput .indexfield = 4 ; 
  370. void expand ( ) 
  371. {expand_regmem 
  372.   halfword t  ; 
  373.   halfword p, q, r  ; 
  374.   integer j  ; 
  375.   integer cvbackup  ; 
  376.   smallnumber cvlbackup, radixbackup, cobackup  ; 
  377.   halfword backupbackup  ; 
  378.   smallnumber savescannerstatus  ; 
  379.   cvbackup = curval ; 
  380.   cvlbackup = curvallevel ; 
  381.   radixbackup = radix ; 
  382.   cobackup = curorder ; 
  383.   backupbackup = mem [ memtop - 13 ] .hh .v.RH ; 
  384.   if ( curcmd < 111 ) 
  385.   {
  386.     if ( eqtb [ 6199 ] .cint > 1 ) 
  387.     showcurcmdchr () ; 
  388.     switch ( curcmd ) 
  389.     {case 110 : 
  390.       {
  391.     if ( curmark [ curchr ] != 0 ) 
  392.     begintokenlist ( curmark [ curchr ] , 14 ) ; 
  393.       } 
  394.       break ; 
  395.     case 102 : 
  396.       {
  397.     gettoken () ; 
  398.     t = curtok ; 
  399.     gettoken () ; 
  400.     if ( curcmd > 100 ) 
  401.     expand () ; 
  402.     else backinput () ; 
  403.     curtok = t ; 
  404.     backinput () ; 
  405.       } 
  406.       break ; 
  407.     case 103 : 
  408.       {
  409.     savescannerstatus = scannerstatus ; 
  410.     scannerstatus = 0 ; 
  411.     gettoken () ; 
  412.     scannerstatus = savescannerstatus ; 
  413.     t = curtok ; 
  414.     backinput () ; 
  415.     if ( t >= 4095 ) 
  416.     {
  417.       p = getavail () ; 
  418.       mem [ p ] .hh .v.LH = 7618 ; 
  419.       mem [ p ] .hh .v.RH = curinput .locfield ; 
  420.       curinput .startfield = p ; 
  421.       curinput .locfield = p ; 
  422.     } 
  423.       } 
  424.       break ; 
  425.     case 107 : 
  426.       {
  427.     r = getavail () ; 
  428.     p = r ; 
  429.     do {
  430.         getxtoken () ; 
  431.       if ( curcs == 0 ) 
  432.       {
  433.         q = getavail () ; 
  434.         mem [ p ] .hh .v.RH = q ; 
  435.         mem [ q ] .hh .v.LH = curtok ; 
  436.         p = q ; 
  437.       } 
  438.     } while ( ! ( curcs != 0 ) ) ; 
  439.     if ( curcmd != 67 ) 
  440.     {
  441.       {
  442.         if ( interaction == 3 ) 
  443.         wakeupterminal () ; 
  444.         printnl ( 262 ) ; 
  445.         print ( 621 ) ; 
  446.       } 
  447.       printesc ( 501 ) ; 
  448.       print ( 622 ) ; 
  449.       {
  450.         helpptr = 2 ; 
  451.         helpline [ 1 ] = 623 ; 
  452.         helpline [ 0 ] = 624 ; 
  453.       } 
  454.       backerror () ; 
  455.     } 
  456.     j = first ; 
  457.     p = mem [ r ] .hh .v.RH ; 
  458.     while ( p != 0 ) {
  459.         
  460.       if ( j >= maxbufstack ) 
  461.       {
  462.         maxbufstack = j + 1 ; 
  463.         if ( maxbufstack == bufsize ) 
  464.         overflow ( 256 , bufsize ) ; 
  465.       } 
  466.       buffer [ j ] = mem [ p ] .hh .v.LH % 256 ; 
  467.       incr ( j ) ; 
  468.       p = mem [ p ] .hh .v.RH ; 
  469.     } 
  470.     if ( j > first + 1 ) 
  471.     {
  472.       nonewcontrolsequence = false ; 
  473.       curcs = idlookup ( first , j - first ) ; 
  474.       nonewcontrolsequence = true ; 
  475.     } 
  476.     else if ( j == first ) 
  477.     curcs = 513 ; 
  478.     else curcs = 257 + buffer [ first ] ; 
  479.     flushlist ( r ) ; 
  480.     if ( eqtb [ curcs ] .hh.b0 == 101 ) 
  481.     {
  482.       eqdefine ( curcs , 0 , 256 ) ; 
  483.     } 
  484.     curtok = curcs + 4095 ; 
  485.     backinput () ; 
  486.       } 
  487.       break ; 
  488.     case 108 : 
  489.       convtoks () ; 
  490.       break ; 
  491.     case 109 : 
  492.       insthetoks () ; 
  493.       break ; 
  494.     case 105 : 
  495.       conditional () ; 
  496.       break ; 
  497.     case 106 : 
  498.       if ( curchr > iflimit ) 
  499.       if ( iflimit == 1 ) 
  500.       insertrelax () ; 
  501.       else {
  502.       
  503.     {
  504.       if ( interaction == 3 ) 
  505.       wakeupterminal () ; 
  506.       printnl ( 262 ) ; 
  507.       print ( 772 ) ; 
  508.     } 
  509.     printcmdchr ( 106 , curchr ) ; 
  510.     {
  511.       helpptr = 1 ; 
  512.       helpline [ 0 ] = 773 ; 
  513.     } 
  514.     error () ; 
  515.       } 
  516.       else {
  517.       
  518.     while ( curchr != 2 ) passtext () ; 
  519.     {
  520.       p = condptr ; 
  521.       ifline = mem [ p + 1 ] .cint ; 
  522.       curif = mem [ p ] .hh.b1 ; 
  523.       iflimit = mem [ p ] .hh.b0 ; 
  524.       condptr = mem [ p ] .hh .v.RH ; 
  525.       freenode ( p , 2 ) ; 
  526.     } 
  527.       } 
  528.       break ; 
  529.     case 104 : 
  530.       if ( curchr > 0 ) 
  531.       forceeof = true ; 
  532.       else if ( nameinprogress ) 
  533.       insertrelax () ; 
  534.       else startinput () ; 
  535.       break ; 
  536.       default: 
  537.       {
  538.     {
  539.       if ( interaction == 3 ) 
  540.       wakeupterminal () ; 
  541.       printnl ( 262 ) ; 
  542.       print ( 615 ) ; 
  543.     } 
  544.     {
  545.       helpptr = 5 ; 
  546.       helpline [ 4 ] = 616 ; 
  547.       helpline [ 3 ] = 617 ; 
  548.       helpline [ 2 ] = 618 ; 
  549.       helpline [ 1 ] = 619 ; 
  550.       helpline [ 0 ] = 620 ; 
  551.     } 
  552.     error () ; 
  553.       } 
  554.       break ; 
  555.     } 
  556.   } 
  557.   else if ( curcmd < 115 ) 
  558.   macrocall () ; 
  559.   else {
  560.       
  561.     curtok = 7615 ; 
  562.     backinput () ; 
  563.   } 
  564.   curval = cvbackup ; 
  565.   curvallevel = cvlbackup ; 
  566.   radix = radixbackup ; 
  567.   curorder = cobackup ; 
  568.   mem [ memtop - 13 ] .hh .v.RH = backupbackup ; 
  569. void getxtoken ( ) 
  570. {/* 20 30 */ getxtoken_regmem 
  571.   lab20: getnext () ; 
  572.   if ( curcmd <= 100 ) 
  573.   goto lab30 ; 
  574.   if ( curcmd >= 111 ) 
  575.   if ( curcmd < 115 ) 
  576.   macrocall () ; 
  577.   else {
  578.       
  579.     curcs = 3520 ; 
  580.     curcmd = 9 ; 
  581.     goto lab30 ; 
  582.   } 
  583.   else expand () ; 
  584.   goto lab20 ; 
  585.   lab30: if ( curcs == 0 ) 
  586.   curtok = ( curcmd * 256 ) + curchr ; 
  587.   else curtok = 4095 + curcs ; 
  588. void xtoken ( ) 
  589. {xtoken_regmem 
  590.   while ( curcmd > 100 ) {
  591.       
  592.     expand () ; 
  593.     getnext () ; 
  594.   } 
  595.   if ( curcs == 0 ) 
  596.   curtok = ( curcmd * 256 ) + curchr ; 
  597.   else curtok = 4095 + curcs ; 
  598. void scanleftbrace ( ) 
  599. {scanleftbrace_regmem 
  600.   do {
  601.       getxtoken () ; 
  602.   } while ( ! ( ( curcmd != 10 ) && ( curcmd != 0 ) ) ) ; 
  603.   if ( curcmd != 1 ) 
  604.   {
  605.     {
  606.       if ( interaction == 3 ) 
  607.       wakeupterminal () ; 
  608.       printnl ( 262 ) ; 
  609.       print ( 653 ) ; 
  610.     } 
  611.     {
  612.       helpptr = 4 ; 
  613.       helpline [ 3 ] = 654 ; 
  614.       helpline [ 2 ] = 655 ; 
  615.       helpline [ 1 ] = 656 ; 
  616.       helpline [ 0 ] = 657 ; 
  617.     } 
  618.     backerror () ; 
  619.     curtok = 379 ; 
  620.     curcmd = 1 ; 
  621.     curchr = 123 ; 
  622.     incr ( alignstate ) ; 
  623.   } 
  624. void scanoptionalequals ( ) 
  625. {scanoptionalequals_regmem 
  626.   do {
  627.       getxtoken () ; 
  628.   } while ( ! ( curcmd != 10 ) ) ; 
  629.   if ( curtok != 3133 ) 
  630.   backinput () ; 
  631. boolean zscankeyword ( s ) 
  632. strnumber s ; 
  633. {/* 10 */ register boolean Result; scankeyword_regmem 
  634.   halfword p  ; 
  635.   halfword q  ; 
  636.   poolpointer k  ; 
  637.   p = memtop - 13 ; 
  638.   mem [ p ] .hh .v.RH = 0 ; 
  639.   k = strstart [ s ] ; 
  640.   while ( k < strstart [ s + 1 ] ) {
  641.       
  642.     getxtoken () ; 
  643.     if ( ( curcs == 0 ) && ( ( curchr == strpool [ k ] ) || ( curchr == 
  644.     strpool [ k ] - 32 ) ) ) 
  645.     {
  646.       {
  647.     q = getavail () ; 
  648.     mem [ p ] .hh .v.RH = q ; 
  649.     mem [ q ] .hh .v.LH = curtok ; 
  650.     p = q ; 
  651.       } 
  652.       incr ( k ) ; 
  653.     } 
  654.     else if ( ( curcmd != 10 ) || ( p != memtop - 13 ) ) 
  655.     {
  656.       backinput () ; 
  657.       if ( p != memtop - 13 ) 
  658.       begintokenlist ( mem [ memtop - 13 ] .hh .v.RH , 3 ) ; 
  659.       Result = false ; 
  660.       return(Result) ; 
  661.     } 
  662.   } 
  663.   flushlist ( mem [ memtop - 13 ] .hh .v.RH ) ; 
  664.   Result = true ; 
  665.   return(Result) ; 
  666. void muerror ( ) 
  667. {muerror_regmem 
  668.   {
  669.     if ( interaction == 3 ) 
  670.     wakeupterminal () ; 
  671.     printnl ( 262 ) ; 
  672.     print ( 658 ) ; 
  673.   } 
  674.   {
  675.     helpptr = 1 ; 
  676.     helpline [ 0 ] = 659 ; 
  677.   } 
  678.   error () ; 
  679. void scaneightbitint ( ) 
  680. {scaneightbitint_regmem 
  681.   scanint () ; 
  682.   if ( ( curval < 0 ) || ( curval > 255 ) ) 
  683.   {
  684.     {
  685.       if ( interaction == 3 ) 
  686.       wakeupterminal () ; 
  687.       printnl ( 262 ) ; 
  688.       print ( 683 ) ; 
  689.     } 
  690.     {
  691.       helpptr = 2 ; 
  692.       helpline [ 1 ] = 684 ; 
  693.       helpline [ 0 ] = 685 ; 
  694.     } 
  695.     interror ( curval ) ; 
  696.     curval = 0 ; 
  697.   } 
  698. void scancharnum ( ) 
  699. {scancharnum_regmem 
  700.   scanint () ; 
  701.   if ( ( curval < 0 ) || ( curval > 255 ) ) 
  702.   {
  703.     {
  704.       if ( interaction == 3 ) 
  705.       wakeupterminal () ; 
  706.       printnl ( 262 ) ; 
  707.       print ( 686 ) ; 
  708.     } 
  709.     {
  710.       helpptr = 2 ; 
  711.       helpline [ 1 ] = 687 ; 
  712.       helpline [ 0 ] = 685 ; 
  713.     } 
  714.     interror ( curval ) ; 
  715.     curval = 0 ; 
  716.   } 
  717. void scanfourbitint ( ) 
  718. {scanfourbitint_regmem 
  719.   scanint () ; 
  720.   if ( ( curval < 0 ) || ( curval > 15 ) ) 
  721.   {
  722.     {
  723.       if ( interaction == 3 ) 
  724.       wakeupterminal () ; 
  725.       printnl ( 262 ) ; 
  726.       print ( 688 ) ; 
  727.     } 
  728.     {
  729.       helpptr = 2 ; 
  730.       helpline [ 1 ] = 689 ; 
  731.       helpline [ 0 ] = 685 ; 
  732.     } 
  733.     interror ( curval ) ; 
  734.     curval = 0 ; 
  735.   } 
  736. void scanfifteenbitint ( ) 
  737. {scanfifteenbitint_regmem 
  738.   scanint () ; 
  739.   if ( ( curval < 0 ) || ( curval > 32767 ) ) 
  740.   {
  741.     {
  742.       if ( interaction == 3 ) 
  743.       wakeupterminal () ; 
  744.       printnl ( 262 ) ; 
  745.       print ( 690 ) ; 
  746.     } 
  747.     {
  748.       helpptr = 2 ; 
  749.       helpline [ 1 ] = 691 ; 
  750.       helpline [ 0 ] = 685 ; 
  751.     } 
  752.     interror ( curval ) ; 
  753.     curval = 0 ; 
  754.   } 
  755. void scantwentysevenbitint ( ) 
  756. {scantwentysevenbitint_regmem 
  757.   scanint () ; 
  758.   if ( ( curval < 0 ) || ( curval > 134217727L ) ) 
  759.   {
  760.     {
  761.       if ( interaction == 3 ) 
  762.       wakeupterminal () ; 
  763.       printnl ( 262 ) ; 
  764.       print ( 692 ) ; 
  765.     } 
  766.     {
  767.       helpptr = 2 ; 
  768.       helpline [ 1 ] = 693 ; 
  769.       helpline [ 0 ] = 685 ; 
  770.     } 
  771.     interror ( curval ) ; 
  772.     curval = 0 ; 
  773.   } 
  774. void scanfontident ( ) 
  775. {scanfontident_regmem 
  776.   internalfontnumber f  ; 
  777.   halfword m  ; 
  778.   do {
  779.       getxtoken () ; 
  780.   } while ( ! ( curcmd != 10 ) ) ; 
  781.   if ( curcmd == 88 ) 
  782.   f = eqtb [ 4834 ] .hh .v.RH ; 
  783.   else if ( curcmd == 87 ) 
  784.   f = curchr ; 
  785.   else if ( curcmd == 86 ) 
  786.   {
  787.     m = curchr ; 
  788.     scanfourbitint () ; 
  789.     f = eqtb [ m + curval ] .hh .v.RH ; 
  790.   } 
  791.   else {
  792.       
  793.     {
  794.       if ( interaction == 3 ) 
  795.       wakeupterminal () ; 
  796.       printnl ( 262 ) ; 
  797.       print ( 810 ) ; 
  798.     } 
  799.     {
  800.       helpptr = 2 ; 
  801.       helpline [ 1 ] = 811 ; 
  802.       helpline [ 0 ] = 812 ; 
  803.     } 
  804.     backerror () ; 
  805.     f = 0 ; 
  806.   } 
  807.   curval = f ; 
  808. void zfindfontdimen ( writing ) 
  809. boolean writing ; 
  810. {findfontdimen_regmem 
  811.   internalfontnumber f  ; 
  812.   integer n  ; 
  813.   scanint () ; 
  814.   n = curval ; 
  815.   scanfontident () ; 
  816.   f = curval ; 
  817.   if ( n <= 0 ) 
  818.   curval = fmemptr ; 
  819.   else {
  820.       
  821.     if ( writing && ( n <= 4 ) && ( n >= 2 ) && ( fontglue [ f ] != 0 ) ) 
  822.     {
  823.       deleteglueref ( fontglue [ f ] ) ; 
  824.       fontglue [ f ] = 0 ; 
  825.     } 
  826.     if ( n > fontparams [ f ] ) 
  827.     if ( f < fontptr ) 
  828.     curval = fmemptr ; 
  829.     else {
  830.     
  831.       do {
  832.       if ( fmemptr == fontmemsize ) 
  833.     overflow ( 817 , fontmemsize ) ; 
  834.     fontinfo [ fmemptr ] .cint = 0 ; 
  835.     incr ( fmemptr ) ; 
  836.     incr ( fontparams [ f ] ) ; 
  837.       } while ( ! ( n == fontparams [ f ] ) ) ; 
  838.       curval = fmemptr - 1 ; 
  839.     } 
  840.     else curval = n + parambase [ f ] ; 
  841.   } 
  842.   if ( curval == fmemptr ) 
  843.   {
  844.     {
  845.       if ( interaction == 3 ) 
  846.       wakeupterminal () ; 
  847.       printnl ( 262 ) ; 
  848.       print ( 795 ) ; 
  849.     } 
  850.     printesc ( hash [ 3524 + f ] .v.RH ) ; 
  851.     print ( 813 ) ; 
  852.     printint ( fontparams [ f ] ) ; 
  853.     print ( 814 ) ; 
  854.     {
  855.       helpptr = 2 ; 
  856.       helpline [ 1 ] = 815 ; 
  857.       helpline [ 0 ] = 816 ; 
  858.     } 
  859.     error () ; 
  860.   } 
  861. void zscansomethinginternal ( level , negative ) 
  862. smallnumber level ; 
  863. boolean negative ; 
  864. {scansomethinginternal_regmem 
  865.   halfword m  ; 
  866.   integer p  ; 
  867.   m = curchr ; 
  868.   switch ( curcmd ) 
  869.   {case 85 : 
  870.     {
  871.       scancharnum () ; 
  872.       if ( m == 5907 ) 
  873.       {
  874.     curval = eqtb [ 5907 + curval ] .hh .v.RH ; 
  875.     curvallevel = 0 ; 
  876.       } 
  877.       else if ( m < 5907 ) 
  878.       {
  879.     curval = eqtb [ m + curval ] .hh .v.RH ; 
  880.     curvallevel = 0 ; 
  881.       } 
  882.       else {
  883.       
  884.     curval = eqtb [ m + curval ] .cint ; 
  885.     curvallevel = 0 ; 
  886.       } 
  887.     } 
  888.     break ; 
  889.   case 71 : 
  890.   case 72 : 
  891.   case 86 : 
  892.   case 87 : 
  893.   case 88 : 
  894.     if ( level != 5 ) 
  895.     {
  896.       {
  897.     if ( interaction == 3 ) 
  898.     wakeupterminal () ; 
  899.     printnl ( 262 ) ; 
  900.     print ( 660 ) ; 
  901.       } 
  902.       {
  903.     helpptr = 3 ; 
  904.     helpline [ 2 ] = 661 ; 
  905.     helpline [ 1 ] = 662 ; 
  906.     helpline [ 0 ] = 663 ; 
  907.       } 
  908.       backerror () ; 
  909.       {
  910.     curval = 0 ; 
  911.     curvallevel = 1 ; 
  912.       } 
  913.     } 
  914.     else if ( curcmd <= 72 ) 
  915.     {
  916.       if ( curcmd < 72 ) 
  917.       {
  918.     scaneightbitint () ; 
  919.     m = 4322 + curval ; 
  920.       } 
  921.       {
  922.     curval = eqtb [ m ] .hh .v.RH ; 
  923.     curvallevel = 5 ; 
  924.       } 
  925.     } 
  926.     else {
  927.     
  928.       backinput () ; 
  929.       scanfontident () ; 
  930.       {
  931.     curval = 3524 + curval ; 
  932.     curvallevel = 4 ; 
  933.       } 
  934.     } 
  935.     break ; 
  936.   case 73 : 
  937.     {
  938.       curval = eqtb [ m ] .cint ; 
  939.       curvallevel = 0 ; 
  940.     } 
  941.     break ; 
  942.   case 74 : 
  943.     {
  944.       curval = eqtb [ m ] .cint ; 
  945.       curvallevel = 1 ; 
  946.     } 
  947.     break ; 
  948.   case 75 : 
  949.     {
  950.       curval = eqtb [ m ] .hh .v.RH ; 
  951.       curvallevel = 2 ; 
  952.     } 
  953.     break ; 
  954.   case 76 : 
  955.     {
  956.       curval = eqtb [ m ] .hh .v.RH ; 
  957.       curvallevel = 3 ; 
  958.     } 
  959.     break ; 
  960.   case 79 : 
  961.     if ( abs ( curlist .modefield ) != m ) 
  962.     {
  963.       {
  964.     if ( interaction == 3 ) 
  965.     wakeupterminal () ; 
  966.     printnl ( 262 ) ; 
  967.     print ( 676 ) ; 
  968.       } 
  969.       printcmdchr ( 79 , m ) ; 
  970.       {
  971.     helpptr = 4 ; 
  972.     helpline [ 3 ] = 677 ; 
  973.     helpline [ 2 ] = 678 ; 
  974.     helpline [ 1 ] = 679 ; 
  975.     helpline [ 0 ] = 680 ; 
  976.       } 
  977.       error () ; 
  978.       if ( level != 5 ) 
  979.       {
  980.     curval = 0 ; 
  981.     curvallevel = 1 ; 
  982.       } 
  983.       else {
  984.       
  985.     curval = 0 ; 
  986.     curvallevel = 0 ; 
  987.       } 
  988.     } 
  989.     else if ( m == 1 ) 
  990.     {
  991.       curval = curlist .auxfield .cint ; 
  992.       curvallevel = 1 ; 
  993.     } 
  994.     else {
  995.     
  996.       curval = curlist .auxfield .hh .v.LH ; 
  997.       curvallevel = 0 ; 
  998.     } 
  999.     break ; 
  1000.   case 80 : 
  1001.     if ( curlist .modefield == 0 ) 
  1002.     {
  1003.       curval = 0 ; 
  1004.       curvallevel = 0 ; 
  1005.     } 
  1006.     else {
  1007.     
  1008.       nest [ nestptr ] = curlist ; 
  1009.       p = nestptr ; 
  1010.       while ( abs ( nest [ p ] .modefield ) != 1 ) decr ( p ) ; 
  1011.       {
  1012.     curval = nest [ p ] .pgfield ; 
  1013.     curvallevel = 0 ; 
  1014.       } 
  1015.     } 
  1016.     break ; 
  1017.   case 82 : 
  1018.     {
  1019.       if ( m == 0 ) 
  1020.       curval = deadcycles ; 
  1021.       else curval = insertpenalties ; 
  1022.       curvallevel = 0 ; 
  1023.     } 
  1024.     break ; 
  1025.   case 81 : 
  1026.     {
  1027.       if ( ( pagecontents == 0 ) && ( ! outputactive ) ) 
  1028.       if ( m == 0 ) 
  1029.       curval = 1073741823L ; 
  1030.       else curval = 0 ; 
  1031.       else curval = pagesofar [ m ] ; 
  1032.       curvallevel = 1 ; 
  1033.     } 
  1034.     break ; 
  1035.   case 84 : 
  1036.     {
  1037.       if ( eqtb [ 4312 ] .hh .v.RH == 0 ) 
  1038.       curval = 0 ; 
  1039.       else curval = mem [ eqtb [ 4312 ] .hh .v.RH ] .hh .v.LH ; 
  1040.       curvallevel = 0 ; 
  1041.     } 
  1042.     break ; 
  1043.   case 83 : 
  1044.     {
  1045.       scaneightbitint () ; 
  1046.       if ( eqtb [ 4578 + curval ] .hh .v.RH == 0 ) 
  1047.       curval = 0 ; 
  1048.       else curval = mem [ eqtb [ 4578 + curval ] .hh .v.RH + m ] .cint ; 
  1049.       curvallevel = 1 ; 
  1050.     } 
  1051.     break ; 
  1052.   case 68 : 
  1053.   case 69 : 
  1054.     {
  1055.       curval = curchr ; 
  1056.       curvallevel = 0 ; 
  1057.     } 
  1058.     break ; 
  1059.   case 77 : 
  1060.     {
  1061.       findfontdimen ( false ) ; 
  1062.       fontinfo [ fmemptr ] .cint = 0 ; 
  1063.       {
  1064.     curval = fontinfo [ curval ] .cint ; 
  1065.     curvallevel = 1 ; 
  1066.       } 
  1067.     } 
  1068.     break ; 
  1069.   case 78 : 
  1070.     {
  1071.       scanfontident () ; 
  1072.       if ( m == 0 ) 
  1073.       {
  1074.     curval = hyphenchar [ curval ] ; 
  1075.     curvallevel = 0 ; 
  1076.       } 
  1077.       else {
  1078.       
  1079.     curval = skewchar [ curval ] ; 
  1080.     curvallevel = 0 ; 
  1081.       } 
  1082.     } 
  1083.     break ; 
  1084.   case 89 : 
  1085.     {
  1086.       scaneightbitint () ; 
  1087.       switch ( m ) 
  1088.       {case 0 : 
  1089.     curval = eqtb [ 6218 + curval ] .cint ; 
  1090.     break ; 
  1091.       case 1 : 
  1092.     curval = eqtb [ 6751 + curval ] .cint ; 
  1093.     break ; 
  1094.       case 2 : 
  1095.     curval = eqtb [ 3800 + curval ] .hh .v.RH ; 
  1096.     break ; 
  1097.       case 3 : 
  1098.     curval = eqtb [ 4056 + curval ] .hh .v.RH ; 
  1099.     break ; 
  1100.       } 
  1101.       curvallevel = m ; 
  1102.     } 
  1103.     break ; 
  1104.   case 70 : 
  1105.     if ( curchr > 2 ) 
  1106.     {
  1107.       if ( curchr == 3 ) 
  1108.       curval = line ; 
  1109.       else curval = lastbadness ; 
  1110.       curvallevel = 0 ; 
  1111.     } 
  1112.     else {
  1113.     
  1114.       if ( curchr == 2 ) 
  1115.       curval = 0 ; 
  1116.       else curval = 0 ; 
  1117.       curvallevel = curchr ; 
  1118.       if ( ! ( curlist .tailfield >= himemmin ) && ( curlist .modefield != 0 ) 
  1119.       ) 
  1120.       switch ( curchr ) 
  1121.       {case 0 : 
  1122.     if ( mem [ curlist .tailfield ] .hh.b0 == 12 ) 
  1123.     curval = mem [ curlist .tailfield + 1 ] .cint ; 
  1124.     break ; 
  1125.       case 1 : 
  1126.     if ( mem [ curlist .tailfield ] .hh.b0 == 11 ) 
  1127.     curval = mem [ curlist .tailfield + 1 ] .cint ; 
  1128.     break ; 
  1129.       case 2 : 
  1130.     if ( mem [ curlist .tailfield ] .hh.b0 == 10 ) 
  1131.     {
  1132.       curval = mem [ curlist .tailfield + 1 ] .hh .v.LH ; 
  1133.       if ( mem [ curlist .tailfield ] .hh.b1 == 99 ) 
  1134.       curvallevel = 3 ; 
  1135.     } 
  1136.     break ; 
  1137.       } 
  1138.       else if ( ( curlist .modefield == 1 ) && ( curlist .tailfield == curlist 
  1139.       .headfield ) ) 
  1140.       switch ( curchr ) 
  1141.       {case 0 : 
  1142.     curval = lastpenalty ; 
  1143.     break ; 
  1144.       case 1 : 
  1145.     curval = lastkern ; 
  1146.     break ; 
  1147.       case 2 : 
  1148.     if ( lastglue != 65535L ) 
  1149.     curval = lastglue ; 
  1150.     break ; 
  1151.       } 
  1152.     } 
  1153.     break ; 
  1154.     default: 
  1155.     {
  1156.       {
  1157.     if ( interaction == 3 ) 
  1158.     wakeupterminal () ; 
  1159.     printnl ( 262 ) ; 
  1160.     print ( 681 ) ; 
  1161.       } 
  1162.       printcmdchr ( curcmd , curchr ) ; 
  1163.       print ( 682 ) ; 
  1164.       printesc ( 533 ) ; 
  1165.       {
  1166.     helpptr = 1 ; 
  1167.     helpline [ 0 ] = 680 ; 
  1168.       } 
  1169.       error () ; 
  1170.       if ( level != 5 ) 
  1171.       {
  1172.     curval = 0 ; 
  1173.     curvallevel = 1 ; 
  1174.       } 
  1175.       else {
  1176.       
  1177.     curval = 0 ; 
  1178.     curvallevel = 0 ; 
  1179.       } 
  1180.     } 
  1181.     break ; 
  1182.   } 
  1183.   while ( curvallevel > level ) {
  1184.       
  1185.     if ( curvallevel == 2 ) 
  1186.     curval = mem [ curval + 1 ] .cint ; 
  1187.     else if ( curvallevel == 3 ) 
  1188.     muerror () ; 
  1189.     decr ( curvallevel ) ; 
  1190.   } 
  1191.   if ( negative ) 
  1192.   if ( curvallevel >= 2 ) 
  1193.   {
  1194.     curval = newspec ( curval ) ; 
  1195.     {
  1196.       mem [ curval + 1 ] .cint = - (integer) mem [ curval + 1 ] .cint ; 
  1197.       mem [ curval + 2 ] .cint = - (integer) mem [ curval + 2 ] .cint ; 
  1198.       mem [ curval + 3 ] .cint = - (integer) mem [ curval + 3 ] .cint ; 
  1199.     } 
  1200.   } 
  1201.   else curval = - (integer) curval ; 
  1202.   else if ( ( curvallevel >= 2 ) && ( curvallevel <= 3 ) ) 
  1203.   incr ( mem [ curval ] .hh .v.RH ) ; 
  1204.