home *** CD-ROM | disk | FTP | other *** search
- #define EXTERN extern
- #include "texd.h"
-
- #ifdef STAT
- void zshoweqtb ( n )
- halfword n ;
- {showeqtb_regmem
- if ( n < 1 )
- printchar ( 63 ) ;
- else if ( n < 3782 )
- {
- sprintcs ( n ) ;
- printchar ( 61 ) ;
- printcmdchr ( eqtb [ n ] .hh.b0 , eqtb [ n ] .hh .v.RH ) ;
- if ( eqtb [ n ] .hh.b0 >= 111 )
- {
- printchar ( 58 ) ;
- showtokenlist ( mem [ eqtb [ n ] .hh .v.RH ] .hh .v.RH , 0 , 32 ) ;
- }
- }
- else if ( n < 4312 )
- if ( n < 3800 )
- {
- printskipparam ( n - 3782 ) ;
- printchar ( 61 ) ;
- if ( n < 3797 )
- printspec ( eqtb [ n ] .hh .v.RH , 393 ) ;
- else printspec ( eqtb [ n ] .hh .v.RH , 334 ) ;
- }
- else if ( n < 4056 )
- {
- printesc ( 391 ) ;
- printint ( n - 3800 ) ;
- printchar ( 61 ) ;
- printspec ( eqtb [ n ] .hh .v.RH , 393 ) ;
- }
- else {
-
- printesc ( 392 ) ;
- printint ( n - 4056 ) ;
- printchar ( 61 ) ;
- printspec ( eqtb [ n ] .hh .v.RH , 334 ) ;
- }
- else if ( n < 6163 )
- if ( n == 4312 )
- {
- printesc ( 404 ) ;
- printchar ( 61 ) ;
- if ( eqtb [ 4312 ] .hh .v.RH == 0 )
- printchar ( 48 ) ;
- else printint ( mem [ eqtb [ 4312 ] .hh .v.RH ] .hh .v.LH ) ;
- }
- else if ( n < 4322 )
- {
- printcmdchr ( 72 , n ) ;
- printchar ( 61 ) ;
- if ( eqtb [ n ] .hh .v.RH != 0 )
- showtokenlist ( mem [ eqtb [ n ] .hh .v.RH ] .hh .v.RH , 0 , 32 ) ;
- }
- else if ( n < 4578 )
- {
- printesc ( 403 ) ;
- printint ( n - 4322 ) ;
- printchar ( 61 ) ;
- if ( eqtb [ n ] .hh .v.RH != 0 )
- showtokenlist ( mem [ eqtb [ n ] .hh .v.RH ] .hh .v.RH , 0 , 32 ) ;
- }
- else if ( n < 4834 )
- {
- printesc ( 405 ) ;
- printint ( n - 4578 ) ;
- printchar ( 61 ) ;
- if ( eqtb [ n ] .hh .v.RH == 0 )
- print ( 406 ) ;
- else {
-
- depththreshold = 0 ;
- breadthmax = 1 ;
- shownodelist ( eqtb [ n ] .hh .v.RH ) ;
- }
- }
- else if ( n < 4883 )
- {
- if ( n == 4834 )
- print ( 407 ) ;
- else if ( n < 4851 )
- {
- printesc ( 408 ) ;
- printint ( n - 4835 ) ;
- }
- else if ( n < 4867 )
- {
- printesc ( 409 ) ;
- printint ( n - 4851 ) ;
- }
- else {
-
- printesc ( 410 ) ;
- printint ( n - 4867 ) ;
- }
- printchar ( 61 ) ;
- printesc ( hash [ 3524 + eqtb [ n ] .hh .v.RH ] .v.RH ) ;
- }
- else if ( n < 5907 )
- {
- if ( n < 5139 )
- {
- printesc ( 411 ) ;
- printint ( n - 4883 ) ;
- }
- else if ( n < 5395 )
- {
- printesc ( 412 ) ;
- printint ( n - 5139 ) ;
- }
- else if ( n < 5651 )
- {
- printesc ( 413 ) ;
- printint ( n - 5395 ) ;
- }
- else {
-
- printesc ( 414 ) ;
- printint ( n - 5651 ) ;
- }
- printchar ( 61 ) ;
- printint ( eqtb [ n ] .hh .v.RH ) ;
- }
- else {
-
- printesc ( 415 ) ;
- printint ( n - 5907 ) ;
- printchar ( 61 ) ;
- printint ( eqtb [ n ] .hh .v.RH ) ;
- }
- else if ( n < 6730 )
- {
- if ( n < 6218 )
- printparam ( n - 6163 ) ;
- else if ( n < 6474 )
- {
- printesc ( 472 ) ;
- printint ( n - 6218 ) ;
- }
- else {
-
- printesc ( 473 ) ;
- printint ( n - 6474 ) ;
- }
- printchar ( 61 ) ;
- printint ( eqtb [ n ] .cint ) ;
- }
- else if ( n <= 7006 )
- {
- if ( n < 6751 )
- printlengthparam ( n - 6730 ) ;
- else {
-
- printesc ( 496 ) ;
- printint ( n - 6751 ) ;
- }
- printchar ( 61 ) ;
- printscaled ( eqtb [ n ] .cint ) ;
- print ( 393 ) ;
- }
- else printchar ( 63 ) ;
- }
- #endif /* STAT */
- halfword zidlookup ( j , l )
- integer j ;
- integer l ;
- {/* 40 */ register halfword Result; idlookup_regmem
- integer h ;
- integer d ;
- halfword p ;
- halfword k ;
- h = buffer [ j ] ;
- {register integer for_end; k = j + 1 ; for_end = j + l - 1 ; if ( k <=
- for_end) do
- {
- h = h + h + buffer [ k ] ;
- while ( h >= 2551 ) h = h - 2551 ;
- }
- while ( k++ < for_end ) ; }
- p = h + 514 ;
- while ( true ) {
-
- if ( hash [ p ] .v.RH > 0 )
- if ( ( strstart [ hash [ p ] .v.RH + 1 ] - strstart [ hash [ p ] .v.RH ] )
- == l )
- if ( streqbuf ( hash [ p ] .v.RH , j ) )
- goto lab40 ;
- if ( hash [ p ] .v.LH == 0 )
- {
- if ( nonewcontrolsequence )
- p = 3781 ;
- else {
-
- if ( hash [ p ] .v.RH > 0 )
- {
- do {
- if ( ( hashused == 514 ) )
- overflow ( 499 , 3000 ) ;
- decr ( hashused ) ;
- } while ( ! ( hash [ hashused ] .v.RH == 0 ) ) ;
- hash [ p ] .v.LH = hashused ;
- p = hashused ;
- }
- {
- if ( poolptr + l > poolsize )
- overflow ( 257 , poolsize - initpoolptr ) ;
- }
- d = ( poolptr - strstart [ strptr ] ) ;
- while ( poolptr > strstart [ strptr ] ) {
-
- decr ( poolptr ) ;
- strpool [ poolptr + l ] = strpool [ poolptr ] ;
- }
- {register integer for_end; k = j ; for_end = j + l - 1 ; if ( k <=
- for_end) do
- {
- strpool [ poolptr ] = buffer [ k ] ;
- incr ( poolptr ) ;
- }
- while ( k++ < for_end ) ; }
- hash [ p ] .v.RH = makestring () ;
- poolptr = poolptr + d ;
- ;
- #ifdef STAT
- incr ( cscount ) ;
- #endif /* STAT */
- }
- goto lab40 ;
- }
- p = hash [ p ] .v.LH ;
- }
- lab40: Result = p ;
- return(Result) ;
- }
- void znewsavelevel ( c )
- groupcode c ;
- {newsavelevel_regmem
- if ( saveptr > maxsavestack )
- {
- maxsavestack = saveptr ;
- if ( maxsavestack > savesize - 6 )
- overflow ( 537 , savesize ) ;
- }
- savestack [ saveptr ] .hh.b0 = 3 ;
- savestack [ saveptr ] .hh.b1 = curgroup ;
- savestack [ saveptr ] .hh .v.RH = curboundary ;
- if ( curlevel == 255 )
- overflow ( 538 , 255 ) ;
- curboundary = saveptr ;
- incr ( curlevel ) ;
- incr ( saveptr ) ;
- curgroup = c ;
- }
- void zeqdestroy ( w )
- memoryword w ;
- {eqdestroy_regmem
- halfword q ;
- switch ( w .hh.b0 )
- {case 111 :
- case 112 :
- case 113 :
- case 114 :
- deletetokenref ( w .hh .v.RH ) ;
- break ;
- case 117 :
- deleteglueref ( w .hh .v.RH ) ;
- break ;
- case 118 :
- {
- q = w .hh .v.RH ;
- if ( q != 0 )
- freenode ( q , mem [ q ] .hh .v.LH + mem [ q ] .hh .v.LH + 1 ) ;
- }
- break ;
- case 119 :
- flushnodelist ( w .hh .v.RH ) ;
- break ;
- default:
- ;
- break ;
- }
- }
- void zeqsave ( p , l )
- halfword p ;
- quarterword l ;
- {eqsave_regmem
- if ( saveptr > maxsavestack )
- {
- maxsavestack = saveptr ;
- if ( maxsavestack > savesize - 6 )
- overflow ( 537 , savesize ) ;
- }
- if ( l == 0 )
- savestack [ saveptr ] .hh.b0 = 1 ;
- else {
-
- savestack [ saveptr ] = eqtb [ p ] ;
- incr ( saveptr ) ;
- savestack [ saveptr ] .hh.b0 = 0 ;
- }
- savestack [ saveptr ] .hh.b1 = l ;
- savestack [ saveptr ] .hh .v.RH = p ;
- incr ( saveptr ) ;
- }
- void zeqdefine ( p , t , e )
- halfword p ;
- quarterword t ;
- halfword e ;
- {eqdefine_regmem
- if ( eqtb [ p ] .hh.b1 == curlevel )
- eqdestroy ( eqtb [ p ] ) ;
- else if ( curlevel > 1 )
- eqsave ( p , eqtb [ p ] .hh.b1 ) ;
- eqtb [ p ] .hh.b1 = curlevel ;
- eqtb [ p ] .hh.b0 = t ;
- eqtb [ p ] .hh .v.RH = e ;
- }
- void zeqworddefine ( p , w )
- halfword p ;
- integer w ;
- {eqworddefine_regmem
- if ( xeqlevel [ p ] != curlevel )
- {
- eqsave ( p , xeqlevel [ p ] ) ;
- xeqlevel [ p ] = curlevel ;
- }
- eqtb [ p ] .cint = w ;
- }
- void zgeqdefine ( p , t , e )
- halfword p ;
- quarterword t ;
- halfword e ;
- {geqdefine_regmem
- eqdestroy ( eqtb [ p ] ) ;
- eqtb [ p ] .hh.b1 = 1 ;
- eqtb [ p ] .hh.b0 = t ;
- eqtb [ p ] .hh .v.RH = e ;
- }
- void zgeqworddefine ( p , w )
- halfword p ;
- integer w ;
- {geqworddefine_regmem
- eqtb [ p ] .cint = w ;
- xeqlevel [ p ] = 1 ;
- }
- void zsaveforafter ( t )
- halfword t ;
- {saveforafter_regmem
- if ( curlevel > 1 )
- {
- if ( saveptr > maxsavestack )
- {
- maxsavestack = saveptr ;
- if ( maxsavestack > savesize - 6 )
- overflow ( 537 , savesize ) ;
- }
- savestack [ saveptr ] .hh.b0 = 2 ;
- savestack [ saveptr ] .hh.b1 = 0 ;
- savestack [ saveptr ] .hh .v.RH = t ;
- incr ( saveptr ) ;
- }
- }
- #ifdef STAT
- void zrestoretrace ( p , s )
- halfword p ;
- strnumber s ;
- {restoretrace_regmem
- begindiagnostic () ;
- printchar ( 123 ) ;
- print ( s ) ;
- printchar ( 32 ) ;
- showeqtb ( p ) ;
- printchar ( 125 ) ;
- enddiagnostic ( false ) ;
- }
- #endif /* STAT */
- void unsave ( )
- {/* 30 */ unsave_regmem
- halfword p ;
- quarterword l ;
- halfword t ;
- if ( curlevel > 1 )
- {
- decr ( curlevel ) ;
- while ( true ) {
-
- decr ( saveptr ) ;
- if ( savestack [ saveptr ] .hh.b0 == 3 )
- goto lab30 ;
- p = savestack [ saveptr ] .hh .v.RH ;
- if ( savestack [ saveptr ] .hh.b0 == 2 )
- {
- t = curtok ;
- curtok = p ;
- backinput () ;
- curtok = t ;
- }
- else {
-
- if ( savestack [ saveptr ] .hh.b0 == 0 )
- {
- l = savestack [ saveptr ] .hh.b1 ;
- decr ( saveptr ) ;
- }
- else savestack [ saveptr ] = eqtb [ 3781 ] ;
- if ( p < 6163 )
- if ( eqtb [ p ] .hh.b1 == 1 )
- {
- eqdestroy ( savestack [ saveptr ] ) ;
- ;
- #ifdef STAT
- if ( eqtb [ 6200 ] .cint > 0 )
- restoretrace ( p , 540 ) ;
- #endif /* STAT */
- }
- else {
-
- eqdestroy ( eqtb [ p ] ) ;
- eqtb [ p ] = savestack [ saveptr ] ;
- ;
- #ifdef STAT
- if ( eqtb [ 6200 ] .cint > 0 )
- restoretrace ( p , 541 ) ;
- #endif /* STAT */
- }
- else if ( xeqlevel [ p ] != 1 )
- {
- eqtb [ p ] = savestack [ saveptr ] ;
- xeqlevel [ p ] = l ;
- ;
- #ifdef STAT
- if ( eqtb [ 6200 ] .cint > 0 )
- restoretrace ( p , 541 ) ;
- #endif /* STAT */
- }
- else {
-
- ;
- #ifdef STAT
- if ( eqtb [ 6200 ] .cint > 0 )
- restoretrace ( p , 540 ) ;
- #endif /* STAT */
- }
- }
- }
- lab30: curgroup = savestack [ saveptr ] .hh.b1 ;
- curboundary = savestack [ saveptr ] .hh .v.RH ;
- }
- else confusion ( 539 ) ;
- }
- void preparemag ( )
- {preparemag_regmem
- if ( ( magset > 0 ) && ( eqtb [ 6180 ] .cint != magset ) )
- {
- {
- if ( interaction == 3 )
- wakeupterminal () ;
- printnl ( 262 ) ;
- print ( 543 ) ;
- }
- printint ( eqtb [ 6180 ] .cint ) ;
- print ( 544 ) ;
- printnl ( 545 ) ;
- {
- helpptr = 2 ;
- helpline [ 1 ] = 546 ;
- helpline [ 0 ] = 547 ;
- }
- interror ( magset ) ;
- geqworddefine ( 6180 , magset ) ;
- }
- if ( ( eqtb [ 6180 ] .cint <= 0 ) || ( eqtb [ 6180 ] .cint > 32768L ) )
- {
- {
- if ( interaction == 3 )
- wakeupterminal () ;
- printnl ( 262 ) ;
- print ( 548 ) ;
- }
- {
- helpptr = 1 ;
- helpline [ 0 ] = 549 ;
- }
- interror ( eqtb [ 6180 ] .cint ) ;
- geqworddefine ( 6180 , 1000 ) ;
- }
- magset = eqtb [ 6180 ] .cint ;
- }
- void ztokenshow ( p )
- halfword p ;
- {tokenshow_regmem
- if ( p != 0 )
- showtokenlist ( mem [ p ] .hh .v.RH , 0 , 10000000L ) ;
- }
- void printmeaning ( )
- {printmeaning_regmem
- printcmdchr ( curcmd , curchr ) ;
- if ( curcmd >= 111 )
- {
- printchar ( 58 ) ;
- println () ;
- tokenshow ( curchr ) ;
- }
- else if ( curcmd == 110 )
- {
- printchar ( 58 ) ;
- println () ;
- tokenshow ( curmark [ curchr ] ) ;
- }
- }
- void showcurcmdchr ( )
- {showcurcmdchr_regmem
- begindiagnostic () ;
- printnl ( 123 ) ;
- if ( curlist .modefield != shownmode )
- {
- printmode ( curlist .modefield ) ;
- print ( 564 ) ;
- shownmode = curlist .modefield ;
- }
- printcmdchr ( curcmd , curchr ) ;
- printchar ( 125 ) ;
- enddiagnostic ( false ) ;
- }
- void showcontext ( )
- {/* 30 */ showcontext_regmem
- schar oldsetting ;
- integer nn ;
- boolean bottomline ;
- integer i ;
- integer j ;
- integer l ;
- integer m ;
- integer n ;
- integer p ;
- integer q ;
- baseptr = inputptr ;
- inputstack [ baseptr ] = curinput ;
- nn = -1 ;
- bottomline = false ;
- while ( true ) {
-
- curinput = inputstack [ baseptr ] ;
- if ( ( curinput .statefield != 0 ) )
- if ( ( curinput .namefield > 17 ) || ( baseptr == 0 ) )
- bottomline = true ;
- if ( ( baseptr == inputptr ) || bottomline || ( nn < eqtb [ 6217 ] .cint )
- )
- {
- if ( ( baseptr == inputptr ) || ( curinput .statefield != 0 ) || (
- curinput .indexfield != 3 ) || ( curinput .locfield != 0 ) )
- {
- tally = 0 ;
- oldsetting = selector ;
- if ( curinput .statefield != 0 )
- {
- if ( curinput .namefield <= 17 )
- if ( ( curinput .namefield == 0 ) )
- if ( baseptr == 0 )
- printnl ( 570 ) ;
- else printnl ( 571 ) ;
- else {
-
- printnl ( 572 ) ;
- if ( curinput .namefield == 17 )
- printchar ( 42 ) ;
- else printint ( curinput .namefield - 1 ) ;
- printchar ( 62 ) ;
- }
- else {
-
- printnl ( 573 ) ;
- printint ( line ) ;
- }
- printchar ( 32 ) ;
- {
- l = tally ;
- tally = 0 ;
- selector = 20 ;
- trickcount = 1000000L ;
- }
- if ( buffer [ curinput .limitfield ] == eqtb [ 6211 ] .cint )
- j = curinput .limitfield ;
- else j = curinput .limitfield + 1 ;
- if ( j > 0 )
- {register integer for_end; i = curinput .startfield ; for_end = j -
- 1 ; if ( i <= for_end) do
- {
- if ( i == curinput .locfield )
- {
- firstcount = tally ;
- trickcount = tally + 1 + errorline - halferrorline ;
- if ( trickcount < errorline )
- trickcount = errorline ;
- }
- print ( buffer [ i ] ) ;
- }
- while ( i++ < for_end ) ; }
- }
- else {
-
- switch ( curinput .indexfield )
- {case 0 :
- printnl ( 574 ) ;
- break ;
- case 1 :
- case 2 :
- printnl ( 575 ) ;
- break ;
- case 3 :
- if ( curinput .locfield == 0 )
- printnl ( 576 ) ;
- else printnl ( 577 ) ;
- break ;
- case 4 :
- printnl ( 578 ) ;
- break ;
- case 5 :
- {
- println () ;
- printcs ( curinput .namefield ) ;
- }
- break ;
- case 6 :
- printnl ( 579 ) ;
- break ;
- case 7 :
- printnl ( 580 ) ;
- break ;
- case 8 :
- printnl ( 581 ) ;
- break ;
- case 9 :
- printnl ( 582 ) ;
- break ;
- case 10 :
- printnl ( 583 ) ;
- break ;
- case 11 :
- printnl ( 584 ) ;
- break ;
- case 12 :
- printnl ( 585 ) ;
- break ;
- case 13 :
- printnl ( 586 ) ;
- break ;
- case 14 :
- printnl ( 587 ) ;
- break ;
- case 15 :
- printnl ( 588 ) ;
- break ;
- default:
- printnl ( 63 ) ;
- break ;
- }
- {
- l = tally ;
- tally = 0 ;
- selector = 20 ;
- trickcount = 1000000L ;
- }
- if ( curinput .indexfield < 5 )
- showtokenlist ( curinput .startfield , curinput .locfield , 100000L
- ) ;
- else showtokenlist ( mem [ curinput .startfield ] .hh .v.RH ,
- curinput .locfield , 100000L ) ;
- }
- selector = oldsetting ;
- if ( trickcount == 1000000L )
- {
- firstcount = tally ;
- trickcount = tally + 1 + errorline - halferrorline ;
- if ( trickcount < errorline )
- trickcount = errorline ;
- }
- if ( tally < trickcount )
- m = tally - firstcount ;
- else m = trickcount - firstcount ;
- if ( l + firstcount <= halferrorline )
- {
- p = 0 ;
- n = l + firstcount ;
- }
- else {
-
- print ( 275 ) ;
- p = l + firstcount - halferrorline + 3 ;
- n = halferrorline ;
- }
- {register integer for_end; q = p ; for_end = firstcount - 1 ; if ( q
- <= for_end) do
- printchar ( trickbuf [ q % errorline ] ) ;
- while ( q++ < for_end ) ; }
- println () ;
- {register integer for_end; q = 1 ; for_end = n ; if ( q <= for_end)
- do
- printchar ( 32 ) ;
- while ( q++ < for_end ) ; }
- if ( m + n <= errorline )
- p = firstcount + m ;
- else p = firstcount + ( errorline - n - 3 ) ;
- {register integer for_end; q = firstcount ; for_end = p - 1 ; if ( q
- <= for_end) do
- printchar ( trickbuf [ q % errorline ] ) ;
- while ( q++ < for_end ) ; }
- if ( m + n > errorline )
- print ( 275 ) ;
- incr ( nn ) ;
- }
- }
- else if ( nn == eqtb [ 6217 ] .cint )
- {
- printnl ( 275 ) ;
- incr ( nn ) ;
- }
- if ( bottomline )
- goto lab30 ;
- decr ( baseptr ) ;
- }
- lab30: curinput = inputstack [ inputptr ] ;
- }
- void zbegintokenlist ( p , t )
- halfword p ;
- quarterword t ;
- {begintokenlist_regmem
- {
- if ( inputptr > maxinstack )
- {
- maxinstack = inputptr ;
- if ( inputptr == stacksize )
- overflow ( 589 , stacksize ) ;
- }
- inputstack [ inputptr ] = curinput ;
- incr ( inputptr ) ;
- }
- curinput .statefield = 0 ;
- curinput .startfield = p ;
- curinput .indexfield = t ;
- if ( t >= 5 )
- {
- incr ( mem [ p ] .hh .v.LH ) ;
- if ( t == 5 )
- curinput .limitfield = paramptr ;
- else {
-
- curinput .locfield = mem [ p ] .hh .v.RH ;
- if ( eqtb [ 6193 ] .cint > 1 )
- {
- begindiagnostic () ;
- printnl ( 335 ) ;
- switch ( t )
- {case 14 :
- printesc ( 348 ) ;
- break ;
- case 15 :
- printesc ( 590 ) ;
- break ;
- default:
- printcmdchr ( 72 , t + 4307 ) ;
- break ;
- }
- print ( 552 ) ;
- tokenshow ( p ) ;
- enddiagnostic ( false ) ;
- }
- }
- }
- else curinput .locfield = p ;
- }
- void endtokenlist ( )
- {endtokenlist_regmem
- if ( curinput .indexfield >= 3 )
- {
- if ( curinput .indexfield <= 4 )
- flushlist ( curinput .startfield ) ;
- else {
-
- deletetokenref ( curinput .startfield ) ;
- if ( curinput .indexfield == 5 )
- while ( paramptr > curinput .limitfield ) {
-
- decr ( paramptr ) ;
- flushlist ( paramstack [ paramptr ] ) ;
- }
- }
- }
- else if ( curinput .indexfield == 1 )
- if ( alignstate > 500000L )
- alignstate = 0 ;
- else fatalerror ( 591 ) ;
- {
- decr ( inputptr ) ;
- curinput = inputstack [ inputptr ] ;
- }
- {
- if ( interrupt != 0 )
- pauseforinstructions () ;
- }
- }
- void backinput ( )
- {backinput_regmem
- halfword p ;
- while ( ( curinput .statefield == 0 ) && ( curinput .locfield == 0 ) )
- endtokenlist () ;
- p = getavail () ;
- mem [ p ] .hh .v.LH = curtok ;
- if ( curtok < 768 )
- if ( curtok < 512 )
- decr ( alignstate ) ;
- else incr ( alignstate ) ;
- {
- if ( inputptr > maxinstack )
- {
- maxinstack = inputptr ;
- if ( inputptr == stacksize )
- overflow ( 589 , stacksize ) ;
- }
- inputstack [ inputptr ] = curinput ;
- incr ( inputptr ) ;
- }
- curinput .statefield = 0 ;
- curinput .startfield = p ;
- curinput .indexfield = 3 ;
- curinput .locfield = p ;
- }
- void backerror ( )
- {backerror_regmem
- OKtointerrupt = false ;
- backinput () ;
- OKtointerrupt = true ;
- error () ;
- }
- void inserror ( )
- {inserror_regmem
- OKtointerrupt = false ;
- backinput () ;
- curinput .indexfield = 4 ;
- OKtointerrupt = true ;
- error () ;
- }
- void beginfilereading ( )
- {beginfilereading_regmem
- if ( inopen == maxinopen )
- overflow ( 592 , maxinopen ) ;
- if ( first == bufsize )
- overflow ( 256 , bufsize ) ;
- incr ( inopen ) ;
- {
- if ( inputptr > maxinstack )
- {
- maxinstack = inputptr ;
- if ( inputptr == stacksize )
- overflow ( 589 , stacksize ) ;
- }
- inputstack [ inputptr ] = curinput ;
- incr ( inputptr ) ;
- }
- curinput .indexfield = inopen ;
- linestack [ curinput .indexfield ] = line ;
- curinput .startfield = first ;
- curinput .statefield = 1 ;
- curinput .namefield = 0 ;
- }
- void endfilereading ( )
- {endfilereading_regmem
- first = curinput .startfield ;
- line = linestack [ curinput .indexfield ] ;
- if ( curinput .namefield > 17 )
- aclose ( inputfile [ curinput .indexfield ] ) ;
- {
- decr ( inputptr ) ;
- curinput = inputstack [ inputptr ] ;
- }
- decr ( inopen ) ;
- }
- void clearforerrorprompt ( )
- {clearforerrorprompt_regmem
- while ( ( curinput .statefield != 0 ) && ( curinput .namefield == 0 ) && (
- inputptr > 0 ) && ( curinput .locfield > curinput .limitfield ) )
- endfilereading () ;
- println () ;
- clearterminal () ;
- }
- void checkoutervalidity ( )
- {checkoutervalidity_regmem
- halfword p ;
- halfword q ;
- if ( scannerstatus != 0 )
- {
- deletionsallowed = false ;
- if ( curcs != 0 )
- {
- if ( ( curinput .statefield == 0 ) || ( curinput .namefield < 1 ) || (
- curinput .namefield > 17 ) )
- {
- p = getavail () ;
- mem [ p ] .hh .v.LH = 4095 + curcs ;
- begintokenlist ( p , 3 ) ;
- }
- curcmd = 10 ;
- curchr = 32 ;
- }
- if ( scannerstatus > 1 )
- {
- runaway () ;
- if ( curcs == 0 )
- {
- if ( interaction == 3 )
- wakeupterminal () ;
- printnl ( 262 ) ;
- print ( 600 ) ;
- }
- else {
-
- curcs = 0 ;
- {
- if ( interaction == 3 )
- wakeupterminal () ;
- printnl ( 262 ) ;
- print ( 601 ) ;
- }
- }
- print ( 602 ) ;
- p = getavail () ;
- switch ( scannerstatus )
- {case 2 :
- {
- print ( 566 ) ;
- mem [ p ] .hh .v.LH = 637 ;
- }
- break ;
- case 3 :
- {
- print ( 608 ) ;
- mem [ p ] .hh .v.LH = partoken ;
- longstate = 113 ;
- }
- break ;
- case 4 :
- {
- print ( 568 ) ;
- mem [ p ] .hh .v.LH = 637 ;
- q = p ;
- p = getavail () ;
- mem [ p ] .hh .v.RH = q ;
- mem [ p ] .hh .v.LH = 7610 ;
- alignstate = -1000000L ;
- }
- break ;
- case 5 :
- {
- print ( 569 ) ;
- mem [ p ] .hh .v.LH = 637 ;
- }
- break ;
- }
- begintokenlist ( p , 4 ) ;
- print ( 603 ) ;
- sprintcs ( warningindex ) ;
- {
- helpptr = 4 ;
- helpline [ 3 ] = 604 ;
- helpline [ 2 ] = 605 ;
- helpline [ 1 ] = 606 ;
- helpline [ 0 ] = 607 ;
- }
- error () ;
- }
- else {
-
- {
- if ( interaction == 3 )
- wakeupterminal () ;
- printnl ( 262 ) ;
- print ( 594 ) ;
- }
- printcmdchr ( 105 , curif ) ;
- print ( 595 ) ;
- printint ( skipline ) ;
- {
- helpptr = 3 ;
- helpline [ 2 ] = 596 ;
- helpline [ 1 ] = 597 ;
- helpline [ 0 ] = 598 ;
- }
- if ( curcs != 0 )
- curcs = 0 ;
- else helpline [ 2 ] = 599 ;
- curtok = 7613 ;
- inserror () ;
- }
- deletionsallowed = true ;
- }
- }
- void getnext ( )
- {/* 20 25 21 26 40 10 */ getnext_regmem
- integer k ;
- halfword t ;
- schar cat ;
- ASCIIcode c, cc ;
- schar d ;
- lab20: curcs = 0 ;
- if ( curinput .statefield != 0 )
- {
- lab25: if ( curinput .locfield <= curinput .limitfield )
- {
- curchr = buffer [ curinput .locfield ] ;
- incr ( curinput .locfield ) ;
- lab21: curcmd = eqtb [ 4883 + curchr ] .hh .v.RH ;
- switch ( curinput .statefield + curcmd )
- {case 10 :
- case 26 :
- case 42 :
- case 27 :
- case 43 :
- goto lab25 ;
- break ;
- case 1 :
- case 17 :
- case 33 :
- {
- if ( curinput .locfield > curinput .limitfield )
- curcs = 513 ;
- else {
-
- lab26: k = curinput .locfield ;
- curchr = buffer [ k ] ;
- cat = eqtb [ 4883 + curchr ] .hh .v.RH ;
- incr ( k ) ;
- if ( cat == 11 )
- curinput .statefield = 17 ;
- else if ( cat == 10 )
- curinput .statefield = 17 ;
- else curinput .statefield = 1 ;
- if ( ( cat == 11 ) && ( k <= curinput .limitfield ) )
- {
- do {
- curchr = buffer [ k ] ;
- cat = eqtb [ 4883 + curchr ] .hh .v.RH ;
- incr ( k ) ;
- } while ( ! ( ( cat != 11 ) || ( k > curinput .limitfield ) ) )
- ;
- {
- if ( buffer [ k ] == curchr )
- if ( cat == 7 )
- if ( k < curinput .limitfield )
- {
- c = buffer [ k + 1 ] ;
- if ( c < 128 )
- {
- d = 2 ;
- if ( ( ( ( c >= 48 ) && ( c <= 57 ) ) || ( ( c >= 97 ) &&
- ( c <= 102 ) ) ) )
- if ( k + 2 <= curinput .limitfield )
- {
- cc = buffer [ k + 2 ] ;
- if ( ( ( ( cc >= 48 ) && ( cc <= 57 ) ) || ( ( cc >= 97
- ) && ( cc <= 102 ) ) ) )
- incr ( d ) ;
- }
- if ( d > 2 )
- {
- if ( c <= 57 )
- curchr = c - 48 ;
- else curchr = c - 87 ;
- if ( cc <= 57 )
- curchr = 16 * curchr + cc - 48 ;
- else curchr = 16 * curchr + cc - 87 ;
- buffer [ k - 1 ] = curchr ;
- }
- else if ( c < 64 )
- buffer [ k - 1 ] = c + 64 ;
- else buffer [ k - 1 ] = c - 64 ;
- curinput .limitfield = curinput .limitfield - d ;
- first = first - d ;
- while ( k <= curinput .limitfield ) {
-
- buffer [ k ] = buffer [ k + d ] ;
- incr ( k ) ;
- }
- goto lab26 ;
- }
- }
- }
- if ( cat != 11 )
- decr ( k ) ;
- if ( k > curinput .locfield + 1 )
- {
- curcs = idlookup ( curinput .locfield , k - curinput .locfield
- ) ;
- curinput .locfield = k ;
- goto lab40 ;
- }
- }
- else {
-
- if ( buffer [ k ] == curchr )
- if ( cat == 7 )
- if ( k < curinput .limitfield )
- {
- c = buffer [ k + 1 ] ;
- if ( c < 128 )
- {
- d = 2 ;
- if ( ( ( ( c >= 48 ) && ( c <= 57 ) ) || ( ( c >= 97 ) && (
- c <= 102 ) ) ) )
- if ( k + 2 <= curinput .limitfield )
- {
- cc = buffer [ k + 2 ] ;
- if ( ( ( ( cc >= 48 ) && ( cc <= 57 ) ) || ( ( cc >= 97 )
- && ( cc <= 102 ) ) ) )
- incr ( d ) ;
- }
- if ( d > 2 )
- {
- if ( c <= 57 )
- curchr = c - 48 ;
- else curchr = c - 87 ;
- if ( cc <= 57 )
- curchr = 16 * curchr + cc - 48 ;
- else curchr = 16 * curchr + cc - 87 ;
- buffer [ k - 1 ] = curchr ;
- }
- else if ( c < 64 )
- buffer [ k - 1 ] = c + 64 ;
- else buffer [ k - 1 ] = c - 64 ;
- curinput .limitfield = curinput .limitfield - d ;
- first = first - d ;
- while ( k <= curinput .limitfield ) {
-
- buffer [ k ] = buffer [ k + d ] ;
- incr ( k ) ;
- }
- goto lab26 ;
- }
- }
- }
- curcs = 257 + buffer [ curinput .locfield ] ;
- incr ( curinput .locfield ) ;
- }
- lab40: curcmd = eqtb [ curcs ] .hh.b0 ;
- curchr = eqtb [ curcs ] .hh .v.RH ;
- if ( curcmd >= 113 )
- checkoutervalidity () ;
- }
- break ;
- case 14 :
- case 30 :
- case 46 :
- {
- curcs = curchr + 1 ;
- curcmd = eqtb [ curcs ] .hh.b0 ;
- curchr = eqtb [ curcs ] .hh .v.RH ;
- curinput .statefield = 1 ;
- if ( curcmd >= 113 )
- checkoutervalidity () ;
- }
- break ;
- case 8 :
- case 24 :
- case 40 :
- {
- if ( curchr == buffer [ curinput .locfield ] )
- if ( curinput .locfield < curinput .limitfield )
- {
- c = buffer [ curinput .locfield + 1 ] ;
- if ( c < 128 )
- {
- curinput .locfield = curinput .locfield + 2 ;
- if ( ( ( ( c >= 48 ) && ( c <= 57 ) ) || ( ( c >= 97 ) && ( c <=
- 102 ) ) ) )
- if ( curinput .locfield <= curinput .limitfield )
- {
- cc = buffer [ curinput .locfield ] ;
- if ( ( ( ( cc >= 48 ) && ( cc <= 57 ) ) || ( ( cc >= 97 ) && (
- cc <= 102 ) ) ) )
- {
- incr ( curinput .locfield ) ;
- if ( c <= 57 )
- curchr = c - 48 ;
- else curchr = c - 87 ;
- if ( cc <= 57 )
- curchr = 16 * curchr + cc - 48 ;
- else curchr = 16 * curchr + cc - 87 ;
- goto lab21 ;
- }
- }
- if ( c < 64 )
- curchr = c + 64 ;
- else curchr = c - 64 ;
- goto lab21 ;
- }
- }
- curinput .statefield = 1 ;
- }
- break ;
- case 16 :
- case 32 :
- case 48 :
- {
- {
- if ( interaction == 3 )
- wakeupterminal () ;
- printnl ( 262 ) ;
- print ( 609 ) ;
- }
- {
- helpptr = 2 ;
- helpline [ 1 ] = 610 ;
- helpline [ 0 ] = 611 ;
- }
- deletionsallowed = false ;
- error () ;
- deletionsallowed = true ;
- goto lab20 ;
- }
- break ;
- case 11 :
- {
- curinput .statefield = 17 ;
- curchr = 32 ;
- }
- break ;
- case 6 :
- {
- curinput .locfield = curinput .limitfield + 1 ;
- curcmd = 10 ;
- curchr = 32 ;
- }
- break ;
- case 22 :
- case 15 :
- case 31 :
- case 47 :
- {
- curinput .locfield = curinput .limitfield + 1 ;
- goto lab25 ;
- }
- break ;
- case 38 :
- {
- curinput .locfield = curinput .limitfield + 1 ;
- curcs = parloc ;
- curcmd = eqtb [ curcs ] .hh.b0 ;
- curchr = eqtb [ curcs ] .hh .v.RH ;
- if ( curcmd >= 113 )
- checkoutervalidity () ;
- }
- break ;
- case 2 :
- incr ( alignstate ) ;
- break ;
- case 18 :
- case 34 :
- {
- curinput .statefield = 1 ;
- incr ( alignstate ) ;
- }
- break ;
- case 3 :
- decr ( alignstate ) ;
- break ;
- case 19 :
- case 35 :
- {
- curinput .statefield = 1 ;
- decr ( alignstate ) ;
- }
- break ;
- case 20 :
- case 21 :
- case 23 :
- case 25 :
- case 28 :
- case 29 :
- case 36 :
- case 37 :
- case 39 :
- case 41 :
- case 44 :
- case 45 :
- curinput .statefield = 1 ;
- break ;
- default:
- ;
- break ;
- }
- }
- else {
-
- curinput .statefield = 33 ;
- if ( curinput .namefield > 17 )
- {
- incr ( line ) ;
- first = curinput .startfield ;
- if ( ! forceeof )
- {
- if ( inputln ( inputfile [ curinput .indexfield ] , true ) )
- firmuptheline () ;
- else forceeof = true ;
- }
- if ( forceeof )
- {
- printchar ( 41 ) ;
- decr ( openparens ) ;
- flush ( stdout ) ;
- forceeof = false ;
- endfilereading () ;
- checkoutervalidity () ;
- goto lab20 ;
- }
- if ( ( eqtb [ 6211 ] .cint < 0 ) || ( eqtb [ 6211 ] .cint > 255 ) )
- decr ( curinput .limitfield ) ;
- else buffer [ curinput .limitfield ] = eqtb [ 6211 ] .cint ;
- first = curinput .limitfield + 1 ;
- curinput .locfield = curinput .startfield ;
- }
- else {
-
- if ( ! ( curinput .namefield == 0 ) )
- {
- curcmd = 0 ;
- curchr = 0 ;
- return ;
- }
- if ( inputptr > 0 )
- {
- endfilereading () ;
- goto lab20 ;
- }
- if ( selector < 18 )
- openlogfile () ;
- if ( interaction > 1 )
- {
- if ( ( eqtb [ 6211 ] .cint < 0 ) || ( eqtb [ 6211 ] .cint > 255 ) )
- incr ( curinput .limitfield ) ;
- if ( curinput .limitfield == curinput .startfield )
- printnl ( 612 ) ;
- println () ;
- first = curinput .startfield ;
- {
- wakeupterminal () ;
- print ( 42 ) ;
- terminput () ;
- }
- curinput .limitfield = last ;
- if ( ( eqtb [ 6211 ] .cint < 0 ) || ( eqtb [ 6211 ] .cint > 255 ) )
- decr ( curinput .limitfield ) ;
- else buffer [ curinput .limitfield ] = eqtb [ 6211 ] .cint ;
- first = curinput .limitfield + 1 ;
- curinput .locfield = curinput .startfield ;
- }
- else fatalerror ( 613 ) ;
- }
- {
- if ( interrupt != 0 )
- pauseforinstructions () ;
- }
- goto lab25 ;
- }
- }
- else if ( curinput .locfield != 0 )
- {
- t = mem [ curinput .locfield ] .hh .v.LH ;
- curinput .locfield = mem [ curinput .locfield ] .hh .v.RH ;
- if ( t >= 4095 )
- {
- curcs = t - 4095 ;
- curcmd = eqtb [ curcs ] .hh.b0 ;
- curchr = eqtb [ curcs ] .hh .v.RH ;
- if ( curcmd >= 113 )
- if ( curcmd == 116 )
- {
- curcs = mem [ curinput .locfield ] .hh .v.LH - 4095 ;
- curinput .locfield = 0 ;
- curcmd = eqtb [ curcs ] .hh.b0 ;
- curchr = eqtb [ curcs ] .hh .v.RH ;
- if ( curcmd > 100 )
- {
- curcmd = 0 ;
- curchr = 257 ;
- }
- }
- else checkoutervalidity () ;
- }
- else {
-
- curcmd = t / 256 ;
- curchr = t % 256 ;
- switch ( curcmd )
- {case 1 :
- incr ( alignstate ) ;
- break ;
- case 2 :
- decr ( alignstate ) ;
- break ;
- case 5 :
- {
- begintokenlist ( paramstack [ curinput .limitfield + curchr - 1 ] ,
- 0 ) ;
- goto lab20 ;
- }
- break ;
- default:
- ;
- break ;
- }
- }
- }
- else {
-
- endtokenlist () ;
- goto lab20 ;
- }
- if ( curcmd <= 5 )
- if ( curcmd >= 4 )
- if ( alignstate == 0 )
- {
- if ( scannerstatus == 4 )
- fatalerror ( 591 ) ;
- curcmd = mem [ curalign + 5 ] .hh .v.LH ;
- mem [ curalign + 5 ] .hh .v.LH = curchr ;
- if ( curcmd == 63 )
- begintokenlist ( memtop - 10 , 2 ) ;
- else begintokenlist ( mem [ curalign + 2 ] .cint , 2 ) ;
- alignstate = 1000000L ;
- goto lab20 ;
- }
- }
-