-- file: TexMathImpl.mesa -- Pascal-to-Mesa translator output, translated at September 27, 1985 10:21:38 am PDT DIRECTORY PascalBasic, TexTypes, TexInteraction, TexMemory, TexSymbols, TexScan, TexOps, TexParagraph, TexBuildPage, TexMath, TexSysdepInline; TexMathImpl: PROGRAM IMPORTS PascalBasic, TexInteraction, TexMemory, TexSymbols, TexScan, TexOps, TexParagraph, TexBuildPage, TexMath, TexSysdepInline EXPORTS TexMath = PUBLIC BEGIN OPEN PascalBasic, TexTypes, TexInteraction, TexMemory, TexSymbols, TexScan, TexOps, TexParagraph, TexBuildPage, TexMath, TexSysdepInline; --:718----720:-- MlistToHlist: PROCEDURE = BEGIN Mlist:Halfword;Penalties:PascalBoolean; Style:SmallNumber;SaveStyle:SmallNumber;Q:Halfword;R:Halfword; RType:SmallNumber;T:SmallNumber;P, X, Y, Z:Halfword;Pen:PascalInteger; S:SmallNumber;MaxH, MaxD:Scaled;Delta:Scaled; Mlist←CurMlist; Penalties←MlistPenalties;Style←CurStyle;Q←Mlist;R←0;RType←17; MaxH←0;MaxD←0;--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--;WHILE Q#0 DO--727:--BEGIN--728:--DO {--Label21:--Delta←0; {{{SELECT Mem[Q]↑.Hh.B0 FROM 18 =>SELECT RType FROM 18,17,19,20,22,30 =>BEGIN Mem[Q]↑.Hh .B0←16; GOTO Label21; END; ENDCASE => NULL;19,21,22,31 =>BEGIN--729: IF RType=18 THEN Mem[R]↑.Hh.B0←16--:729--; IF Mem[Q]↑.Hh.B0=31 THEN GOTO Label80; END;--733:--30 => GOTO Label80; 25 =>BEGIN MakeFraction[Q]; GOTO Label82; END;17 =>BEGIN Delta←MakeOp[Q]; IF Mem[Q]↑.Hh.B1=1 THEN GOTO Label82; END;16 =>MakeOrd[Q];20,23 => NULL; 24 =>MakeRadical[Q];27 =>MakeOver[Q];26 =>MakeUnder[Q]; 28 =>MakeMathAccent[Q];29 =>MakeVcenter[Q];--:733----730: 14 =>BEGIN CurStyle←Mem[Q]↑.Hh.B1;--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--; GOTO Label81; END;15 =>--731: BEGIN SELECT PascalDIVPower2[CurStyle ,1]FROM 0 =>BEGIN P←Mem[Q+1]↑.Hh.Lh; Mem[Q+1]↑.Hh.Lh←0; END;1 =>BEGIN P←Mem[Q+1]↑.Hh.Rh;Mem[Q+1]↑.Hh.Rh←0; END; 2 =>BEGIN P←Mem[Q+2]↑.Hh.Lh;Mem[Q+2]↑.Hh.Lh←0; END; 3 =>BEGIN P←Mem[Q+2]↑.Hh.Rh;Mem[Q+2]↑.Hh.Rh←0; END; ENDCASE; FlushNodeList[Mem[Q+1]↑.Hh.Lh];FlushNodeList[Mem[Q+1]↑.Hh.Rh]; FlushNodeList[Mem[Q+2]↑.Hh.Lh];FlushNodeList[Mem[Q+2]↑.Hh.Rh]; Mem[Q]↑.Hh.B0←14;Mem[Q]↑.Hh.B1←CurStyle;Mem[Q+1]↑.Int←0; Mem[Q+2]↑.Int←0;IF P#0 THEN BEGIN Z←Mem[Q]↑.Hh.Rh;Mem[Q]↑.Hh.Rh←P; WHILE Mem[P]↑.Hh.Rh#0 DO P←Mem[P]↑.Hh.Rh ENDLOOP ;Mem[P]↑.Hh.Rh←Z; END; GOTO Label81; END--:731--;3,4,5,8,12,7 => GOTO Label81; 2 =>BEGIN IF Mem[Q+3]↑.Int>MaxH THEN MaxH←Mem[Q+3]↑.Int; IF Mem[Q+2]↑.Int>MaxD THEN MaxD←Mem[Q+2]↑.Int; GOTO Label81; END; 10 =>BEGIN--732:--IF Mem[Q]↑.Hh.B1=99 THEN BEGIN X←Mem[Q+1]↑.Hh.Lh; Y←MathGlue[X,CurMu];DeleteGlueRef[X];Mem[Q+1]↑.Hh.Lh←Y; Mem[Q]↑.Hh.B1←0; END ELSE IF(CurSize#0)AND (Mem[Q]↑.Hh.B1=98) THEN BEGIN P←Mem[Q]↑.Hh.Rh; IF P#0 THEN IF(Mem[P]↑.Hh.B0=10)OR (Mem[P]↑.Hh.B0=11) THEN BEGIN Mem[Q]↑.Hh. Rh←Mem[P]↑.Hh.Rh;Mem[P]↑.Hh.Rh←0;FlushNodeList[P]; END; END--:732--; GOTO Label81; END;11 =>BEGIN MathKern[Q,CurMu]; GOTO Label81; END;--:730 ENDCASE =>Confusion[747];--754:--SELECT Mem[Q+1]↑.Hh.Rh FROM 1,4 =>--755: BEGIN Fetch[Q+1]; IF( INT[CurI.B0]>0) THEN BEGIN Delta←FontInfo↑[ ItalicBase↑[CurF]+PascalDIVPower2[(CurI.B2) ,2]].Int;P←NewCharacter[CurF,CurC]; IF(Mem[Q+1]↑.Hh.Rh=4)AND (FontInfo↑[2+ParamBase↑[CurF]].Int#0) THEN Delta ←0; IF(Mem[Q+3]↑.Hh.Rh=0)AND (Delta#0) THEN BEGIN Mem[P]↑.Hh.Rh←NewKern[Delta ];Delta←0; END; END ELSE P←0; END--:755--;0 =>P←0;2 =>P←Mem[Q+1]↑.Hh.Lh; 3 =>BEGIN CurMlist←Mem[Q+1]↑.Hh.Lh;SaveStyle←CurStyle; MlistPenalties←FALSE;MlistToHlist[];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--;P←Hpack[Mem[64997]↑.Hh.Rh,0,1]; END; ENDCASE =>Confusion[748];Mem[Q+1]↑.Int←P; IF(Mem[Q+3]↑.Hh.Rh=0)AND (Mem[Q+2]↑.Hh.Rh=0) THEN GOTO Label82; MakeScripts[Q,Delta]--:754----:728--;EXITS Label82 => NULL};Z←Hpack[Mem[Q+1]↑.Int,0,1]; IF Mem[Z+3]↑.Int>MaxH THEN MaxH←Mem[Z+3]↑.Int; IF Mem[Z+2]↑.Int>MaxD THEN MaxD←Mem[Z+2]↑.Int;FreeNode[Z,7];EXITS Label80 => NULL};R←Q; RType←Mem[R]↑.Hh.B0;EXITS Label81 => NULL};Q←Mem[Q]↑.Hh.Rh;EXIT; EXITS Label21 => NULL} ENDLOOP; END--:727-- ENDLOOP ;--729: IF RType=18 THEN Mem[R]↑.Hh.B0←16--:729--;--760:--P←64997;Mem[P]↑.Hh.Rh←0; Q←Mlist;RType←0;CurStyle←Style;--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--;WHILE Q#0 DO BEGIN--761:--T←16;S←4;Pen←10000; {{SELECT Mem[Q]↑.Hh.B0 FROM 17,20,21,22,23 =>T←Mem[Q]↑.Hh.B0;18 =>BEGIN T←18; Pen←Eqtb↑[4776].Int; END;19 =>BEGIN T←19;Pen←Eqtb↑[4777].Int; END; 16,29,27,26 => NULL;24 =>S←5;28 =>S←5;25 =>BEGIN T←23;S←6; END; 30,31 =>T←MakeLeftRight[Q,Style,MaxD,MaxH];14 =>--763: BEGIN CurStyle←Mem[Q]↑.Hh.B1;S←3;--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--; GOTO Label83; END--:763--; 8,12,2,7,5,3,4,10,11 =>BEGIN Mem[P]↑.Hh.Rh←Q;P←Q;Q←Mem[Q]↑.Hh.Rh; Mem[P]↑.Hh.Rh←0; GOTO Label30; END; ENDCASE =>Confusion[749]--:761--;--766: IF INT[RType]>0 THEN BEGIN SELECT StrPool↑[RType*8+T+MagicOffset]FROM 48 =>X←0; 49 =>IF INT[CurStyle]<4 THEN X←15 ELSE X←0;50 =>X←15; 51 =>IF INT[CurStyle]<4 THEN X←16 ELSE X←0; 52 =>IF INT[CurStyle]<4 THEN X←17 ELSE X←0; ENDCASE =>Confusion[751]; IF X#0 THEN BEGIN Y←MathGlue[Eqtb↑[ INT[3026]+X].Hh.Rh,CurMu]; Z←NewGlue[Y];Mem[Y]↑.Hh.Rh←0;Mem[P]↑.Hh.Rh←Z;P←Z;Mem[Z]↑.Hh.B1←X+1; END; END--:766--;--767: IF Mem[Q+1]↑.Int#0 THEN BEGIN Mem[P]↑.Hh.Rh←Mem[Q+1]↑.Int; DO P←Mem[P]↑.Hh.Rh; IF Mem[P]↑.Hh.Rh=0 THEN EXIT; ENDLOOP; END; IF Penalties THEN IF Mem[Q]↑.Hh.Rh#0 THEN IF Pen<10000 THEN BEGIN RType ←Mem[Mem[Q]↑.Hh.Rh]↑.Hh.B0; IF RType#12 THEN IF RType#19 THEN BEGIN Z←NewPenalty[Pen]; Mem[P]↑.Hh.Rh←Z;P←Z; END; END--:767--;RType←T;EXITS Label83 => NULL};R←Q;Q←Mem[Q]↑.Hh.Rh; FreeNode[R,S];EXITS Label30 => NULL}; END--:760-- ENDLOOP ; END;--:726----772:-- PushMath: PROCEDURE[C: GroupCode] = BEGIN PushNest[];CurList.ModeField←-201;CurList.AuxField←0; NewSaveLevel[C]; END;--:1136----1138:-- InitMath: PROCEDURE = BEGIN W:Scaled;L:Scaled;S:Scaled;P:Halfword;Q:Halfword; F:InternalFontNumber;N:PascalInteger;V:Scaled;D:Scaled; GetToken[]; IF(CurCmd=3)AND ( INT[CurList.ModeField]>0) THEN--1145: BEGIN IF CurList.HeadField=CurList.TailField THEN BEGIN PopNest[]; W←-1073741823; END ELSE BEGIN LineBreak[Eqtb↑[4774].Int];--1146: V←Mem[JustBox+4]↑.Int+2*FontInfo↑[6+ParamBase↑[Eqtb↑[4078].Hh.Rh]].Int; W←-1073741823;P←Mem[JustBox+5]↑.Hh.Rh;{WHILE P#0 DO BEGIN--1147: DO {--Label21:--{{IF( INT[P]>=HiMemMin) THEN BEGIN F←Mem[P]↑.Hh.B0; D←FontInfo↑[WidthBase↑[F]+FontInfo↑[CharBase↑[F]+Mem[P]↑.Hh.B1].Qqqq.B0] .Int; GOTO Label40; END;SELECT Mem[P]↑.Hh.B0 FROM 0,1,2 =>BEGIN D←Mem[P+1]↑.Int; GOTO Label40; END;6 =>--652:--BEGIN Mem[64988]↑←Mem[P+1]↑; Mem[64988]↑.Hh.Rh←Mem[P]↑.Hh.Rh;P←64988; GOTO Label21; END--:652--; 11,9 =>D←Mem[P+1]↑.Int;10 =>--1148:--BEGIN Q←Mem[P+1]↑.Hh.Lh;D←Mem[Q+1]↑.Int; IF Mem[JustBox+5]↑.Hh.B0=1 THEN BEGIN IF(Mem[JustBox+5]↑.Hh.B1=Mem[Q]↑.Hh .B0)AND (Mem[Q+2]↑.Int#0) THEN V←1073741823; END ELSE IF Mem[JustBox+5]↑.Hh.B0=2 THEN BEGIN IF( Mem[JustBox+5]↑.Hh.B1=Mem[Q]↑.Hh.B1)AND (Mem[Q+3]↑.Int#0) THEN V←1073741823; END; IF INT[Mem[P]↑.Hh.B1]>=100 THEN GOTO Label40; END--:1148--;8 =>--1361:--D←0--:1361--; ENDCASE =>D←0 --:1147--;IF V<1073741823 THEN V←V+D; GOTO Label45; EXITS Label40 => NULL};IF V<1073741823 THEN BEGIN V←V+D;W←V; END ELSE BEGIN W←1073741823; GOTO Label30; END;EXITS Label45 => NULL};P←Mem[P]↑.Hh.Rh;EXIT; EXITS Label21 => NULL} ENDLOOP; END ENDLOOP ;EXITS Label30 => NULL};--:1146-- END;--1149: IF Eqtb↑[3556].Hh.Rh=0 THEN IF(Eqtb↑[5218].Int#0)AND (((Eqtb↑[4808].Int>=0) AND (CurList.PgField+2>Eqtb↑[4808].Int))OR (CurList.PgField+1<-Eqtb↑ [4808].Int)) THEN BEGIN L←Eqtb↑[5204].Int-ABS[Eqtb↑[5218].Int]; IF Eqtb↑[5218].Int>0 THEN S←Eqtb↑[5218].Int ELSE S←0; END ELSE BEGIN L←Eqtb↑[5204].Int;S←0; END ELSE BEGIN N←Mem[Eqtb↑[3556].Hh.Rh]↑.Hh.Lh; IF CurList.PgField+2>=N THEN P←Eqtb↑[3556].Hh.Rh+2*N ELSE P←Eqtb↑[3556 ].Hh.Rh+2*(CurList.PgField+2);S←Mem[ INT[P]-1]↑.Int;L←Mem[P]↑.Int; END--:1149 ;PushMath[15];CurList.ModeField←201;EqWordDefine[4811,-1]; EqWordDefine[5214,W];EqWordDefine[5215,L];EqWordDefine[5216,S]; IF Eqtb↑[3560].Hh.Rh#0 THEN BeginTokenList[Eqtb↑[3560].Hh.Rh,9]; IF NestPtr=1 THEN BuildPage[]; END--:1145-- ELSE BEGIN BackInput[];--1139: BEGIN PushMath[15];EqWordDefine[4811,-1]; IF Eqtb↑[3559].Hh.Rh#0 THEN BeginTokenList[Eqtb↑[3559].Hh.Rh,8]; END--:1139--; END; END;--:1138----1142:-- END.