-- file: TexRestImpl.mesa -- Pascal-to-Mesa translator output, translated at September 27, 1985 10:21:38 am PDT DIRECTORY PascalBasic, PascalWizardFiles, TexTypes, TexInteraction, TexMemory, TexSymbols, TexScan, TexOps, TexParagraph, TexBuildPage, TexRest, TexSysdepInline; TexRestImpl: PROGRAM IMPORTS TexTypes, TexInteraction, TexMemory, TexSymbols, TexBuildPage, TexSysdepInline EXPORTS TexRest = PUBLIC BEGIN OPEN PascalBasic, PascalWizardFiles, TexTypes, TexInteraction, TexMemory, TexSymbols, TexScan, TexOps, TexParagraph, TexBuildPage, TexRest, TexSysdepInline; MacroCall: PROCEDURE = BEGIN R:Halfword;P:Halfword;Q:Halfword;S:Halfword;T:Halfword;U, V:Halfword; RbracePtr:Halfword;N:SmallNumber;Unbalance:Halfword;M:Halfword; RefCount:Halfword;SaveScannerStatus:SmallNumber; SaveWarningIndex:Halfword;MatchChr:AsciiCode; SaveScannerStatus←ScannerStatus; SaveWarningIndex←WarningIndex;WarningIndex←CurCs; RefCount←CurChr;R←Mem[RefCount]↑.Hh.Rh;N←0; IF Eqtb↑[4797].Int>0 THEN--401:--BEGIN BeginDiagnostic[];PrintLn[]; PrintCs[WarningIndex];TokenShow[RefCount];EndDiagnostic[FALSE]; END--:401--;{IF Mem[R]↑.Hh.Lh#3584 THEN--391:--BEGIN ScannerStatus←3; Unbalance←0;LongState←Eqtb↑[CurCs].Hh.B0; IF INT[LongState]>=112 THEN LongState←LongState-2; DO IF( INT[Mem[R]↑.Hh.Lh]>3455)OR ( INT[Mem[R]↑.Hh.Lh]<3328) THEN S←0 ELSE BEGIN MatchChr← INT[Mem[R]↑.Hh.Lh]-3328;S←Mem[R]↑.Hh.Rh;R←S;P←64997; Mem[P]↑.Hh.Rh←0;M←0; END;--392:--DO {--Label22:--GetToken[]; {IF CurTok=Mem[R]↑.Hh.Lh THEN--394:--BEGIN R←Mem[R]↑.Hh.Rh; IF( INT[Mem[R]↑.Hh.Lh]>=3328)AND ( INT[Mem[R]↑.Hh.Lh]<=3584) THEN BEGIN IF INT[CurTok]<512 THEN AlignState←AlignState-1; GOTO Label40; END ELSE GOTO Label22; END--:394--; --397:--IF S#R THEN IF S=0 THEN--398:--BEGIN BEGIN IF Interaction=3 THEN NULL; PrintNl[134];Print[511]; END;SprintCs[WarningIndex];Print[512]; BEGIN HelpPtr←4;HelpLine↑[3]←513;HelpLine↑[2]←514;HelpLine↑[1]←515; HelpLine↑[0]←516; END;Error[]; GOTO Label10; END--:398-- ELSE BEGIN T←S; DO BEGIN Q←GetAvail[];Mem[P]↑.Hh.Rh←Q;Mem[Q]↑.Hh.Lh←Mem[T]↑.Hh.Lh; P←Q; END;M←M+1;U←Mem[T]↑.Hh.Rh;V←S; {WHILE TRUE DO BEGIN IF U=R THEN IF CurTok#Mem[V]↑.Hh.Lh THEN GOTO Label30 ELSE BEGIN R←Mem[V]↑.Hh.Rh; GOTO Label22; END; IF Mem[U]↑.Hh.Lh#Mem[V]↑.Hh.Lh THEN GOTO Label30;U←Mem[U]↑.Hh.Rh; V←Mem[V]↑.Hh.Rh; END ENDLOOP ;EXITS Label30 => NULL};T←Mem[T]↑.Hh.Rh; IF T=R THEN EXIT; ENDLOOP;R←S; END--:397--; IF CurTok=ParToken THEN IF LongState#111 THEN--396: BEGIN IF LongState=110 THEN BEGIN Runaway[];BEGIN IF Interaction=3 THEN NULL; PrintNl[134];Print[506]; END;SprintCs[WarningIndex];Print[507]; BEGIN HelpPtr←3;HelpLine↑[2]←508;HelpLine↑[1]←509;HelpLine↑[0]←510; END;BackError[]; END;Pstack↑[N]←Mem[64997]↑.Hh.Rh; AlignState←AlignState-Unbalance; FOR i:INT IN [ INT[0 ].. INT[N ]] DO M ← i; FlushList[Pstack↑[M]] ENDLOOP; GOTO Label10; END--:396--; IF INT[CurTok]<768 THEN IF INT[CurTok]<512 THEN--399:--BEGIN Unbalance←1; {WHILE TRUE DO BEGIN BEGIN BEGIN Q←Avail; IF Q=0 THEN Q←GetAvail [] ELSE BEGIN Avail←Mem[Q]↑.Hh.Rh;Mem[Q]↑.Hh.Rh←0; DynUsed←DynUsed+1; END; END;Mem[P]↑.Hh.Rh←Q;Mem[Q]↑.Hh.Lh←CurTok;P←Q; END;GetToken[];IF CurTok=ParToken THEN IF LongState#111 THEN--396: BEGIN IF LongState=110 THEN BEGIN Runaway[];BEGIN IF Interaction=3 THEN NULL; PrintNl[134];Print[506]; END;SprintCs[WarningIndex];Print[507]; BEGIN HelpPtr←3;HelpLine↑[2]←508;HelpLine↑[1]←509;HelpLine↑[0]←510; END;BackError[]; END;Pstack↑[N]←Mem[64997]↑.Hh.Rh; AlignState←AlignState-Unbalance; FOR i:INT IN [ INT[0 ].. INT[N ]] DO M ← i; FlushList[Pstack↑[M]] ENDLOOP; GOTO Label10; END--:396--; IF INT[CurTok]<768 THEN IF INT[CurTok]<512 THEN Unbalance←Unbalance+1 ELSE BEGIN Unbalance← INT[Unbalance]-1;IF Unbalance=0 THEN GOTO Label31; END; END ENDLOOP ; EXITS Label31 => NULL};RbracePtr←P;BEGIN Q←GetAvail[];Mem[P]↑.Hh.Rh←Q; Mem[Q]↑.Hh.Lh←CurTok;P←Q; END; END--:399-- ELSE--395:--BEGIN BackInput[]; BEGIN IF Interaction=3 THEN NULL;PrintNl[134];Print[498]; END; SprintCs[WarningIndex];Print[499];BEGIN HelpPtr←6;HelpLine↑[5]←500; HelpLine↑[4]←501;HelpLine↑[3]←502;HelpLine↑[2]←503;HelpLine↑[1]←504; HelpLine↑[0]←505; END;AlignState←AlignState+1;LongState←110; CurTok←ParToken;InsError[]; END--:395-- ELSE--393: BEGIN IF CurTok=2592 THEN IF INT[Mem[R]↑.Hh.Lh]<=3584 THEN IF INT[Mem[R]↑.Hh.Lh]>=3328 THEN GOTO Label22;BEGIN Q←GetAvail[];Mem[P]↑.Hh.Rh←Q; Mem[Q]↑.Hh.Lh←CurTok;P←Q; END; END--:393--;M←M+1; IF INT[Mem[R]↑.Hh.Lh]>3584 THEN GOTO Label22;IF INT[Mem[R]↑.Hh.Lh]<3328 THEN GOTO Label22; EXITS Label40 => NULL};IF S#0 THEN--400: BEGIN IF(M=1)AND ( INT[Mem[P]↑.Hh.Lh]<768)AND (P#64997) THEN BEGIN Mem[RbracePtr ]↑.Hh.Rh←0;BEGIN Mem[P]↑.Hh.Rh←Avail;Avail←P;DynUsed←DynUsed-1; END; P←Mem[64997]↑.Hh.Rh;Pstack↑[N]←Mem[P]↑.Hh.Rh;BEGIN Mem[P]↑.Hh.Rh←Avail; Avail←P;DynUsed←DynUsed-1; END; END ELSE Pstack↑[N]←Mem[64997]↑.Hh.Rh; N←N+1;IF Eqtb↑[4797].Int>0 THEN BEGIN BeginDiagnostic[]; PrintNl[MatchChr];PrintInt[N];Print[517]; ShowTokenList[Pstack↑[N-1],0,1000];EndDiagnostic[FALSE]; END; END--:400 --:392--;EXIT; EXITS Label22 => NULL} ENDLOOP; IF Mem[R]↑.Hh.Lh=3584 THEN EXIT; ENDLOOP; END--:391--;--390: WHILE(CurInput.StateField=0)AND (CurInput.LocField=0)DO EndTokenList[] ENDLOOP ;BeginTokenList[RefCount,5]; CurInput.NameField←WarningIndex;CurInput.LocField←Mem[R]↑.Hh.Rh; IF INT[N]>0 THEN BEGIN IF ParamPtr+N>MaxParamStack THEN BEGIN MaxParamStack←ParamPtr+N; IF MaxParamStack>ParamSize THEN Overflow[497,ParamSize]; END; FOR i:INT IN [ INT[0 ].. INT[N-1 ]] DO M ← i; ParamStack↑[ INT[ParamPtr]+M]←Pstack↑[M] ENDLOOP; ParamPtr←ParamPtr+N; END--:390--;EXITS Label10 => NULL};ScannerStatus←SaveScannerStatus; WarningIndex←SaveWarningIndex; END;--:389----379: StrToks: PROCEDURE RETURNS[StrToksResult: Halfword] = BEGIN P:Halfword;Q:Halfword;T:Halfword; K:PoolPointer; BEGIN IF INT[PoolPtr+1]>PoolSize THEN Overflow[129, PoolSize-InitPoolPtr]; END;P←64997;Mem[P]↑.Hh.Rh←0;K←StrStart↑[StrPtr]; WHILE INT[K]<PoolPtr DO BEGIN T←StrPool↑[K]; IF T=32 THEN T←2592 ELSE T← INT[3072]+T;BEGIN BEGIN Q←Avail; IF Q=0 THEN Q←GetAvail [] ELSE BEGIN Avail←Mem[Q]↑.Hh.Rh;Mem[Q]↑.Hh.Rh←0; DynUsed←DynUsed+1; END; END;Mem[P]↑.Hh.Rh←Q;Mem[Q]↑.Hh.Lh←T;P←Q; END; K←K+1; END ENDLOOP ;PoolPtr←StrStart↑[StrPtr];StrToksResult←P; END;--:464----465: ResumeAfterDisplay: PROCEDURE = BEGIN IF CurGroup#15 THEN Confusion[1022];Unsave[]; CurList.PgField←CurList.PgField+3;PushNest[]; CurList.ModeField←101;CurList.AuxField←1000;--443: BEGIN GetXToken[];IF CurCmd#10 THEN BackInput[]; END--:443--; IF NestPtr=1 THEN BuildPage[]; END;--:1200----1211:----1215: END.