-- file: TexOps2Impl.mesa -- Pascal-to-Mesa translator output, translated at September 27, 1985 10:21:37 am PDT DIRECTORY PascalBasic, TexTypes, TexInteraction, TexMemory, TexSymbols, TexScan, TexOps, TexBuildPage, TexMath, TexRest, TexSysdepInline; TexOps2Impl: PROGRAM IMPORTS PascalBasic, TexTypes, TexInteraction, TexMemory, TexSymbols, TexScan, TexOps, TexBuildPage, TexMath, TexSysdepInline EXPORTS TexOps = PUBLIC BEGIN OPEN PascalBasic, TexTypes, TexInteraction, TexMemory, TexSymbols, TexScan, TexOps, TexBuildPage, TexMath, TexRest, TexSysdepInline; --711:-- StackIntoBox: PROCEDURE[B: Halfword,F: InternalFontNumber, C: Quarterword] = BEGIN P:Halfword; P←CharBox[F,C]; Mem[P]↑.Hh.Rh←Mem[B+5]↑.Hh.Rh;Mem[B+5]↑.Hh.Rh←P; Mem[B+3]↑.Int←Mem[P+3]↑.Int; END;--:711----712: HeightPlusDepth: PROCEDURE[F: InternalFontNumber,C: Quarterword] RETURNS[HeightPlusDepthResult: Scaled] = BEGIN Q:FourQuarters;Hd:EightBits; Q←FontInfo↑[CharBase↑[F]+C].Qqqq;Hd←Q.B1; HeightPlusDepthResult←FontInfo↑[ HeightBase↑[F]+PascalDIVPower2[(Hd),4]].Int+FontInfo↑ [ DepthBase↑[F]+PascalMODPower2Mask[(Hd),15]].Int; END;--:712 Rebox: PROCEDURE[B: Halfword,W: Scaled] RETURNS[ReboxResult: Halfword] = BEGIN P:Halfword; F:InternalFontNumber;V:Scaled; IF(Mem[B+1]↑.Int#W)AND (Mem[B+5]↑.Hh.Rh#0) THEN BEGIN IF Mem[B]↑.Hh. B0=1 THEN B←Hpack[B,0,1];P←Mem[B+5]↑.Hh.Rh; IF(( INT[P]>=HiMemMin))AND (Mem[P]↑.Hh.Rh=0) THEN BEGIN F←Mem[P]↑.Hh.B0; V←FontInfo↑[WidthBase↑[F]+FontInfo↑[CharBase↑[F]+Mem[P]↑.Hh.B1].Qqqq.B0] .Int;IF V#Mem[B+1]↑.Int THEN Mem[P]↑.Hh.Rh←NewKern[Mem[B+1]↑.Int-V]; END; FreeNode[B,7];B←NewGlue[12];Mem[B]↑.Hh.Rh←P; WHILE Mem[P]↑.Hh.Rh#0 DO P←Mem[P]↑.Hh.Rh ENDLOOP ;Mem[P]↑.Hh.Rh←NewGlue[12]; ReboxResult←Hpack[B,W,0]; END ELSE BEGIN Mem[B+1]↑.Int←W;ReboxResult←B; END; END; FlushMath: PROCEDURE = BEGIN FlushNodeList[Mem[CurList.HeadField]↑.Hh.Rh]; FlushNodeList[CurList.AuxField];Mem[CurList.HeadField]↑.Hh.Rh←0; CurList.TailField←CurList.HeadField;CurList.AuxField←0; END; CleanBox: PROCEDURE[P: Halfword,S: SmallNumber] RETURNS[CleanBoxResult: Halfword] = BEGIN Q:Halfword;SaveStyle:SmallNumber;X:Halfword;R:Halfword; {SELECT Mem[P]↑.Hh.Rh FROM 1 =>BEGIN CurMlist←NewNoad[]; Mem[CurMlist+1]↑←Mem[P]↑; END;2 =>BEGIN Q←Mem[P]↑.Hh.Lh; GOTO Label40; END; 3 =>CurMlist←Mem[P]↑.Hh.Lh; ENDCASE =>BEGIN Q←NewNullBox[]; GOTO Label40; END ; SaveStyle←CurStyle;CurStyle←S;MlistPenalties←FALSE; MlistToHlist[];Q←Mem[64997]↑.Hh.Rh;CurStyle←SaveStyle;--703: BEGIN IF INT[CurStyle]<4 THEN CurSize←0 ELSE CurSize←16*( PascalDIVPower2[(CurStyle-2) ,1]); CurMu←XOverN[FontInfo↑[6+ParamBase↑[Eqtb↑[4081+CurSize].Hh.Rh]].Int, 18]; END--:703--; EXITS Label40 => NULL};IF( INT[Q]>=HiMemMin)OR (Q=0) THEN X←Hpack[Q,0,1] ELSE IF(Mem[Q]↑.Hh.Rh=0) AND ( INT[Mem[Q]↑.Hh.B0]<=1)AND (Mem[Q+4]↑.Int=0) THEN X←Q ELSE X←Hpack[Q,0,1]; --721:--Q←Mem[X+5]↑.Hh.Rh;IF( INT[Q]>=HiMemMin) THEN BEGIN R←Mem[Q]↑.Hh.Rh; IF R#0 THEN IF Mem[R]↑.Hh.Rh=0 THEN IF NOT ( INT[R]>=HiMemMin) THEN IF Mem[R]↑. Hh.B0=11 THEN BEGIN FreeNode[R,2];Mem[Q]↑.Hh.Rh←0; END; END--:721--; CleanBoxResult←X; END;--:720----722:-- Fetch: PROCEDURE[A: Halfword] = BEGIN CurC←Mem[A]↑.Hh.B1;CurF←Eqtb↑[4079+Mem[A]↑.Hh.B0+CurSize].Hh.Rh; IF CurF=0 THEN--723:--BEGIN BEGIN IF Interaction=3 THEN NULL;PrintNl[134]; Print[210]; END;PrintSize[CurSize];PrintChar[32]; PrintInt[Mem[A]↑.Hh.B0];Print[742];PrintAscii[CurC];PrintChar[41]; BEGIN HelpPtr←4;HelpLine↑[3]←743;HelpLine↑[2]←744;HelpLine↑[1]←745; HelpLine↑[0]←746; END;Error[];CurI←NullCharacter;Mem[A]↑.Hh.Rh←0; END--:723 ELSE BEGIN IF( INT[CurC]>=FontBc↑[CurF])AND ( INT[CurC]<=FontEc↑[CurF]) THEN CurI ←FontInfo↑[CharBase↑[CurF]+CurC].Qqqq ELSE CurI←NullCharacter; IF NOT (( INT[CurI.B0]>0)) THEN BEGIN CharWarning[CurF,CurC]; Mem[A]↑.Hh.Rh←0; END; END; END;--:722----726:----734: --762:-- MakeLeftRight: PROCEDURE[Q: Halfword,Style: SmallNumber, MaxD,MaxH: Scaled] RETURNS[MakeLeftRightResult: SmallNumber] = BEGIN Delta, Delta1, Delta2:Scaled; IF INT[Style]<4 THEN CurSize←0 ELSE CurSize←16*( PascalDIVPower2[(Style-2),1]); Delta2←MaxD+FontInfo↑[22+ParamBase↑[Eqtb↑[4081+CurSize].Hh.Rh]].Int; Delta1←MaxH+MaxD-Delta2;IF Delta2>Delta1 THEN Delta1←Delta2; Delta←( Delta1 /500)*Eqtb↑[4785].Int; Delta2←Delta1+Delta1-Eqtb↑[5211].Int;IF Delta<Delta2 THEN Delta←Delta2; Mem[Q+1]↑.Int←VarDelimiter[Q+1,CurSize,Delta]; MakeLeftRightResult←Mem[Q]↑.Hh.B0-(10); END;--:762-- PushAlignment: PROCEDURE = BEGIN P:Halfword; P←GetNode[5];Mem[P]↑.Hh.Rh←AlignPtr; Mem[P]↑.Hh.Lh←CurAlign;Mem[P+1]↑.Hh.Lh←Mem[64992]↑.Hh.Rh; Mem[P+1]↑.Hh.Rh←CurSpan;Mem[P+2]↑.Int←CurLoop; Mem[P+3]↑.Int←AlignState;Mem[P+4]↑.Hh.Lh←CurHead; Mem[P+4]↑.Hh.Rh←CurTail;AlignPtr←P;CurHead←GetAvail[]; END; PopAlignment: PROCEDURE = BEGIN P:Halfword; BEGIN Mem[CurHead]↑.Hh.Rh←Avail;Avail←CurHead; DynUsed←DynUsed-1; END;P←AlignPtr;CurTail←Mem[P+4]↑.Hh.Rh; CurHead←Mem[P+4]↑.Hh.Lh;AlignState←Mem[P+3]↑.Int; CurLoop←Mem[P+2]↑.Int;CurSpan←Mem[P+1]↑.Hh.Rh; Mem[64992]↑.Hh.Rh←Mem[P+1]↑.Hh.Lh;CurAlign←Mem[P]↑.Hh.Lh; AlignPtr←Mem[P]↑.Hh.Rh;FreeNode[P,5]; END;--:772----774:----782: GetPreambleToken: PROCEDURE = BEGIN DO {--Label20:--GetToken[]; WHILE(CurChr=128)AND (CurCmd=4)DO BEGIN GetToken[]; IF INT[CurCmd]>99 THEN BEGIN Expand[];GetToken[]; END; END ENDLOOP ; IF(CurCmd=74)AND (CurChr=3037) THEN BEGIN ScanOptionalEquals[]; ScanGlue[2]; IF Eqtb↑[4810].Int>0 THEN GeqDefine[3037,116,CurVal] ELSE EqDefine[3037 ,116,CurVal]; GOTO Label20; END;EXIT; EXITS Label20 => NULL} ENDLOOP; END;--:782-- InitAlign: PROCEDURE = BEGIN SaveCsPtr:Halfword;P:Halfword; SaveCsPtr←CurCs;PushAlignment[];AlignState←-1000000;--776: IF(CurList.ModeField=201)AND ((CurList.TailField#CurList.HeadField )OR (CurList.AuxField#0)) THEN BEGIN BEGIN IF Interaction=3 THEN NULL; PrintNl[134];Print[539]; END;PrintEsc[382];Print[752]; BEGIN HelpPtr←3;HelpLine↑[2]←753;HelpLine↑[1]←754;HelpLine↑[0]←755; END;Error[];FlushMath[]; END--:776--;PushNest[];--775: IF CurList.ModeField=201 THEN BEGIN CurList.ModeField←-1; CurList.AuxField←Nest↑[NestPtr-2].AuxField; END ELSE IF INT[CurList.ModeField]>0 THEN CurList.ModeField←-CurList. ModeField--:775--;ScanSpec[];NewSaveLevel[6];--777:--Mem[64992]↑.Hh.Rh←0; CurAlign←64992;CurLoop←0;ScannerStatus←4; WarningIndex←SaveCsPtr;AlignState←-1000000; {WHILE TRUE DO BEGIN--778:-- Mem[CurAlign]↑.Hh.Rh←NewParamGlue[11]; CurAlign←Mem[CurAlign]↑.Hh.Rh--:778--;IF CurCmd=5 THEN GOTO Label30;--779: --783:--P←64996;Mem[P]↑.Hh.Rh←0;{WHILE TRUE DO BEGIN GetPreambleToken[]; IF CurCmd=6 THEN GOTO Label31; IF( INT[CurCmd]<=5)AND ( INT[CurCmd]>=4)AND (AlignState=-1000000) THEN IF(P=64996) AND (CurLoop=0)AND (CurCmd=4) THEN CurLoop←CurAlign ELSE BEGIN BEGIN IF Interaction=3 THEN NULL;PrintNl[134];Print[761]; END;BEGIN HelpPtr←3; HelpLine↑[2]←762;HelpLine↑[1]←763;HelpLine↑[0]←764; END;BackError[]; GOTO Label31; END ELSE IF(CurCmd#10)OR (P#64996) THEN BEGIN Mem[P]↑.Hh.Rh←GetAvail[]; P←Mem[P]↑.Hh.Rh;Mem[P]↑.Hh.Lh←CurTok; END; END ENDLOOP ;EXITS Label31 => NULL};--:783--Mem[CurAlign]↑.Hh.Rh←NewNullBox[];CurAlign←Mem[CurAlign]↑.Hh.Rh; Mem[CurAlign]↑.Hh.Lh←64991;Mem[CurAlign+1]↑.Int←-1073741824; Mem[CurAlign+3]↑.Int←Mem[64996]↑.Hh.Rh;--784:--P←64996;Mem[P]↑.Hh.Rh←0; {WHILE TRUE DO BEGIN DO {--Label22:--GetPreambleToken[]; IF( INT[CurCmd]<=5)AND ( INT[CurCmd]>=4)AND (AlignState=-1000000) THEN GOTO Label32; IF CurCmd=6 THEN BEGIN BEGIN IF Interaction=3 THEN NULL;PrintNl[134]; Print[765]; END;BEGIN HelpPtr←3;HelpLine↑[2]←762;HelpLine↑[1]←763; HelpLine↑[0]←766; END;Error[]; GOTO Label22; END;Mem[P]↑.Hh.Rh←GetAvail[]; P←Mem[P]↑.Hh.Rh;Mem[P]↑.Hh.Lh←CurTok;EXIT; EXITS Label22 => NULL} ENDLOOP; END ENDLOOP ;EXITS Label32 => NULL};Mem[P]↑.Hh.Rh←GetAvail[]; P←Mem[P]↑.Hh.Rh;Mem[P]↑.Hh.Lh←6859--:784--; Mem[CurAlign+2]↑.Int←Mem[64996]↑.Hh.Rh--:779--; END ENDLOOP ; EXITS Label30 => NULL};ScannerStatus←0--:777--;NewSaveLevel[6]; IF Eqtb↑[3564].Hh.Rh#0 THEN BeginTokenList[Eqtb↑[3564].Hh.Rh,13]; AlignPeek[]; END;--:774----786:----787:-- InitSpan: PROCEDURE[P: Halfword] = BEGIN PushNest[]; IF CurList.ModeField=-101 THEN CurList.AuxField←1000 ELSE BEGIN CurList.AuxField←-65536000;NormalParagraph[]; END;CurSpan←P; END; --:787-- InitRow: PROCEDURE = BEGIN PushNest[]; CurList.ModeField←(-102)-CurList.ModeField;CurList.AuxField←0; BEGIN Mem[CurList.TailField]↑.Hh.Rh←NewGlue[Mem[Mem[64992]↑.Hh.Rh+1]↑. Hh.Lh];CurList.TailField←Mem[CurList.TailField]↑.Hh.Rh; END; Mem[CurList.TailField]↑.Hh.B1←12; CurAlign←Mem[Mem[64992]↑.Hh.Rh]↑.Hh.Rh;CurTail←CurHead; InitSpan[CurAlign]; END;--:786----788:-- InitCol: PROCEDURE = BEGIN Mem[CurAlign+5]↑.Hh.Lh←CurCmd; IF CurCmd=63 THEN AlignState←0 ELSE BEGIN BackInput[]; BeginTokenList[Mem[CurAlign+3]↑.Int,1]; END; END;--:788----791: FinCol: PROCEDURE RETURNS[FinColResult: PascalBoolean] = BEGIN P:Halfword;Q, R:Halfword; S:Halfword;U:Halfword;W:Scaled;O:GlueOrd;N:Halfword; Q←Mem[CurAlign]↑.Hh.Rh;IF(CurAlign=0)OR (Q=0) THEN Confusion[768]; P←Mem[Q]↑.Hh.Rh;--792: IF(P=0)AND ( INT[Mem[CurAlign+5]↑.Hh.Lh]<129) THEN IF CurLoop#0 THEN--793: BEGIN Mem[Q]↑.Hh.Rh←NewNullBox[];P←Mem[Q]↑.Hh.Rh;Mem[P]↑.Hh.Lh←64991; Mem[P+1]↑.Int←-1073741824;CurLoop←Mem[CurLoop]↑.Hh.Rh;--794:--Q←64996; R←Mem[CurLoop+3]↑.Int;WHILE R#0 DO BEGIN Mem[Q]↑.Hh.Rh←GetAvail[]; Q←Mem[Q]↑.Hh.Rh;Mem[Q]↑.Hh.Lh←Mem[R]↑.Hh.Lh;R←Mem[R]↑.Hh.Rh; END ENDLOOP ; Mem[Q]↑.Hh.Rh←0;Mem[P+3]↑.Int←Mem[64996]↑.Hh.Rh;Q←64996; R←Mem[CurLoop+2]↑.Int;WHILE R#0 DO BEGIN Mem[Q]↑.Hh.Rh←GetAvail[]; Q←Mem[Q]↑.Hh.Rh;Mem[Q]↑.Hh.Lh←Mem[R]↑.Hh.Lh;R←Mem[R]↑.Hh.Rh; END ENDLOOP ; Mem[Q]↑.Hh.Rh←0;Mem[P+2]↑.Int←Mem[64996]↑.Hh.Rh--:794--; CurLoop←Mem[CurLoop]↑.Hh.Rh; Mem[P]↑.Hh.Rh←NewGlue[Mem[CurLoop+1]↑.Hh.Lh]; END--:793 ELSE BEGIN BEGIN IF Interaction=3 THEN NULL;PrintNl[134];Print[769]; END; PrintEsc[757];BEGIN HelpPtr←3;HelpLine↑[2]←770;HelpLine↑[1]←771; HelpLine↑[0]←772; END;Mem[CurAlign+5]↑.Hh.Lh←129;Error[]; END--:792--; {IF Mem[CurAlign+5]↑.Hh.Lh#128 THEN BEGIN Unsave[];NewSaveLevel[6]; --796: BEGIN IF CurList.ModeField=-101 THEN BEGIN AdjustTail←CurTail; U←Hpack[Mem[CurList.HeadField]↑.Hh.Rh,0,1];W←Mem[U+1]↑.Int; CurTail←AdjustTail;AdjustTail←0; END ELSE BEGIN U←Vpackage[Mem[CurList.HeadField]↑.Hh.Rh,0,1,0]; W←Mem[U+3]↑.Int; END;N←0;IF CurSpan#CurAlign THEN--798: BEGIN Q←CurSpan;DO N←N+1;Q←Mem[Mem[Q]↑.Hh.Rh]↑.Hh.Rh; IF Q=CurAlign THEN EXIT; ENDLOOP;IF INT[N]>255 THEN Confusion[773];Q←CurSpan; WHILE INT[Mem[Mem[Q]↑.Hh.Lh]↑.Hh.Rh]<N DO Q←Mem[Q]↑.Hh.Lh ENDLOOP ; IF INT[Mem[Mem[Q]↑.Hh.Lh]↑.Hh.Rh]>N THEN BEGIN S←GetNode[2]; Mem[S]↑.Hh.Lh←Mem[Q]↑.Hh.Lh;Mem[S]↑.Hh.Rh←N;Mem[Q]↑.Hh.Lh←S; Mem[S+1]↑.Int←W; END ELSE IF Mem[Mem[Q]↑.Hh.Lh+1]↑.Int<W THEN Mem[Mem[Q]↑.Hh.Lh+1]↑.Int←W; END--:798-- ELSE IF W>Mem[CurAlign+1]↑.Int THEN Mem[CurAlign+1]↑.Int←W; Mem[U]↑.Hh.B0←13;Mem[U]↑.Hh.B1←N;--659: IF TotalStretch↑[3]#0 THEN O←3 ELSE IF TotalStretch↑[2]#0 THEN O←2 ELSE IF TotalStretch↑[1]#0 THEN O←1 ELSE O←0--:659--;Mem[U+5]↑.Hh.B1←O; Mem[U+6]↑.Int←TotalStretch↑[O];--665: IF TotalShrink↑[3]#0 THEN O←3 ELSE IF TotalShrink↑[2]#0 THEN O←2 ELSE IF TotalShrink↑[1]#0 THEN O←1 ELSE O←0--:665--;Mem[U+5]↑.Hh.B0←O; Mem[U+4]↑.Int←TotalShrink↑[O];PopNest[]; Mem[CurList.TailField]↑.Hh.Rh←U;CurList.TailField←U; END--:796--; --795: BEGIN Mem[CurList.TailField]↑.Hh.Rh←NewGlue[Mem[Mem[CurAlign]↑.Hh.Rh +1]↑.Hh.Lh];CurList.TailField←Mem[CurList.TailField]↑.Hh.Rh; END; Mem[CurList.TailField]↑.Hh.B1←12--:795--; IF INT[Mem[CurAlign+5]↑.Hh.Lh]>=129 THEN BEGIN FinColResult←TRUE; GOTO Label10; END; InitSpan[P]; END;AlignState←1000000;--406:--DO GetXToken[]; IF CurCmd#10--:406-- THEN EXIT; ENDLOOP;CurAlign←P;InitCol[];FinColResult←FALSE;EXITS Label10 => NULL}; END; --:791----799:-- FinRow: PROCEDURE = BEGIN P:Halfword; IF CurList.ModeField=-101 THEN BEGIN P←Hpack[Mem[CurList. HeadField]↑.Hh.Rh,0,1];PopNest[];AppendToVlist[P]; IF CurHead#CurTail THEN BEGIN Mem[CurList.TailField]↑.Hh.Rh←Mem[ CurHead]↑.Hh.Rh;CurList.TailField←CurTail; END; END ELSE BEGIN P←Vpackage[Mem[CurList.HeadField]↑.Hh.Rh,0,1,1073741823 ];PopNest[];Mem[CurList.TailField]↑.Hh.Rh←P;CurList.TailField←P; CurList.AuxField←1000; END;Mem[P]↑.Hh.B0←13;Mem[P+6]↑.Int←0; IF Eqtb↑[3564].Hh.Rh#0 THEN BeginTokenList[Eqtb↑[3564].Hh.Rh,13]; AlignPeek[]; END;--:799----800:-- AlignPeek: PROCEDURE = BEGIN DO {--Label20:--AlignState←1000000;--406: DO GetXToken[]; IF CurCmd#10--:406-- THEN EXIT; ENDLOOP; IF CurCmd=34 THEN BEGIN ScanLeftBrace[];NewSaveLevel[7]; IF CurList.ModeField=-1 THEN NormalParagraph[]; END ELSE IF CurCmd=2 THEN FinAlign [] ELSE IF(CurCmd=5)AND (CurChr=130) THEN GOTO Label20 ELSE BEGIN InitRow[];InitCol[]; END;EXIT; EXITS Label20 => NULL} ENDLOOP; END;--:785----:800----815: END.