#ifdef _WINDOWS #define NOCOMM #define NOSOUND #define NODRIVERS #define STRICT #pragma warning(disable:4115) // kill rpcasync.h complaint #include #endif #ifdef _WINDOWS // We must define MYLIBAPI as __declspec(dllexport) before including // texwin.h, then texwin.h will see that we have already // defined MYLIBAPI and will not (re)define it as __declspec(dllimport) #define MYLIBAPI __declspec(dllexport) // #include "texwin.h" #endif #include "texwin.h" #pragma warning(disable:4131) // old style declarator #pragma warning(disable:4135) // conversion between different integral types #pragma warning(disable:4127) // conditional expression is constant #include #pragma hdrstop #define EXTERN extern #include "texd.h" #pragma warning(disable:4244) /* 96/Jan/10 */ /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */ /* following bit used to be end of tex1.c */ #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 [ (hash_size + 781) ] ; /* undefine_control_sequence */ if ( p < (hash_size + 3163) ) if ( eqtb [ p ] .hh.b1 == 1 ) { eqdestroy ( savestack [ saveptr ] ) ; ; #ifdef STAT if ( eqtb [ (hash_size + 3200) ] .cint > 0 ) restoretrace ( p , 541 ) ; /* retaining */ #endif /* STAT */ } else { eqdestroy ( eqtb [ p ] ) ; eqtb [ p ] = savestack [ saveptr ] ; ; #ifdef STAT if ( eqtb [ (hash_size + 3200) ] .cint > 0 ) restoretrace ( p , 542 ) ; /* restoring */ #endif /* STAT */ } else if ( xeqlevel [ p ] != 1 ) { eqtb [ p ] = savestack [ saveptr ] ; xeqlevel [ p ] = l ; /* l may be used without having been ... */ ; #ifdef STAT if ( eqtb [ (hash_size + 3200) ] .cint > 0 ) restoretrace ( p , 542 ) ; /* restoring */ #endif /* STAT */ } else { ; #ifdef STAT if ( eqtb [ (hash_size + 3200) ] .cint > 0 ) restoretrace ( p , 541 ) ; /* retaining */ #endif /* STAT */ } } } lab30: curgroup = savestack [ saveptr ] .hh.b1 ; curboundary = savestack [ saveptr ] .hh .v.RH ; } else { confusion ( 540 ) ; /* curlevel */ return; // abortflag set } } /* This is where the old tex2.c used to start */ void preparemag ( ) {preparemag_regmem if ( ( magset > 0 ) && ( eqtb [ (hash_size + 3180) ] .cint != magset ) ) { { if ( interaction == 3 ) ; printnl ( 266 ) ; /* ! */ print ( 544 ) ; /* Incompatible magnification ( */ } printint ( eqtb [ (hash_size + 3180) ] .cint ) ; print ( 545 ) ; /* ) */ printnl ( 546 ) ; /* the previous value will be retained */ { helpptr = 2 ; helpline [ 1 ] = 547 ; /* I can handle only one magnification ratio per job. */ helpline [ 0 ] = 548 ; /* So I've reverted to the magnification you used earlier on this run. */ } interror ( magset ) ; ABORTCHECK; geqworddefine ( (hash_size + 3180) , magset ) ; } if ( ( eqtb [ (hash_size + 3180) ] .cint <= 0 ) || ( eqtb [ (hash_size + 3180) ] .cint > 32768L ) ) { { if ( interaction == 3 ) ; printnl ( 262 ) ; /* ! */ print ( 549 ) ; /* Illegal magnification has been changed to 1000 */ } { helpptr = 1 ; helpline [ 0 ] = 550 ; /* The magnification ratio must be between 1 and 32768. */ } interror ( eqtb [ (hash_size + 3180) ] .cint ) ; ABORTCHECK; geqworddefine ( (hash_size + 3180) , 1000 ) ; } magset = eqtb [ (hash_size + 3180) ] .cint ; } void ztokenshow ( p ) halfword p ; {tokenshow_regmem /* begin if p<>null then show_token_list(link(p),null,10000000); l.6289 */ 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 ( 565 ) ; /* : */ shownmode = curlist .modefield ; } printcmdchr ( curcmd , curchr ) ; printchar ( 125 ) ; /* } */ enddiagnostic ( false ) ; } void showcontext ( ) {/* 30 */ showcontext_regmem char oldsetting ; integer nn ; booleane 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 [ (hash_size + 3217) ] .cint ) ) { /* begin if (base_ptr=input_ptr) or (state<>token_list) or (token_type<>backed_up) or (loc<>null) then {we omit backed-up token lists that have already been read} l.6761 */ 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 ( 571 ) ; /* <*> */ else printnl ( 572 ) ; /* */ else { printnl ( 573 ) ; /* */ } else { /* printnl ( 574 ) ; */ /* printint ( line ) ; */ /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */ if (cstyleflag) { /* 94/Mar/21 */ println ( ) ; /* new line */ /* show current input file name - ignore if from terminal */ if (curinput .namefield > 17) /* redundant ? */ print ( curinput .namefield ); printchar ( 40 ); /* ( */ printint ( line ) ; /* line number */ printchar ( 41 ); /* ) */ printchar ( 32 ); /* */ printchar ( 58 ); /* : */ } else { printnl ( 574 ) ; /* l. ? 573 ????? 98/Dec/8 check ! */ printint ( line ) ; /* line number */ } /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */ } printchar ( 32 ) ; /* */ { l = tally ; tally = 0 ; selector = 20 ; trickcount = 1000000L ; } if ( buffer [ curinput .limitfield ] == eqtb [ (hash_size + 3211) ] .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 ( 575 ) ; /* */ break ; case 1 : case 2 : printnl ( 576 ) ; /*