-- file: TexMath4Impl.mesa -- Pascal-to-Mesa translator output, translated at September 27, 1985 10:21:38 am PDT DIRECTORY PascalBasic, TexTypes, TexInteraction, TexMemory, TexSymbols, TexScan, TexOps, TexBuildPage, TexMath, TexRest, TexSysdepInline; TexMath4Impl: PROGRAM IMPORTS PascalBasic, TexTypes, TexInteraction, TexMemory, TexSymbols, TexScan, TexOps, TexBuildPage, TexMath, TexRest, TexSysdepInline EXPORTS TexMath = PUBLIC BEGIN OPEN PascalBasic, TexTypes, TexInteraction, TexMemory, TexSymbols, TexScan, TexOps, TexBuildPage, TexMath, TexRest, TexSysdepInline; StartEqNo: PROCEDURE = BEGIN SaveStack↑[SavePtr+0].Int←CurChr;SavePtr←SavePtr+1;--1139: BEGIN PushMath[15];EqWordDefine[4811,-1]; IF Eqtb↑[3559].Hh.Rh#0 THEN BeginTokenList[Eqtb↑[3559].Hh.Rh,8]; END--:1139--; END;--:1142----1151:-- ScanMath: PROCEDURE[P: Halfword] = BEGIN C:PascalInteger; DO {--Label20:----404:--DO GetXToken[]; IF(CurCmd#10)AND (CurCmd#0)--:404-- THEN EXIT; ENDLOOP; DO {--Label21:--{SELECT CurCmd FROM 11,12,67 =>IF INT[CurChr]>=128 THEN C←CurChr ELSE BEGIN C ←Eqtb↑[ INT[4639]+CurChr].Hh.Rh;IF C=32768 THEN BEGIN--1152: BEGIN CurCs←CurChr+1;CurCmd←Eqtb↑[CurCs].Hh.B0; CurChr←Eqtb↑[CurCs].Hh.Rh;XToken[];BackInput[]; END--:1152--; GOTO Label20; END; END;16 =>BEGIN ScanCharNum[];CurChr←CurVal;CurCmd←67; GOTO Label21; END; 17 =>BEGIN ScanFifteenBitInt[];C←CurVal; END;68 =>C←CurChr; 15 =>BEGIN ScanTwentySevenBitInt[];C← PascalDIVPower2[CurVal ,12]; END; ENDCASE =>--1153:--BEGIN BackInput[];ScanLeftBrace[]; SaveStack↑[SavePtr+0].Int←P;SavePtr←SavePtr+1;PushMath[9]; GOTO Label10; END--:1153--;Mem[P]↑.Hh.Rh←1;Mem[P]↑.Hh.B1← PascalMODPower2Mask[C ,255]; IF(C>=28672)AND ((Eqtb↑[4811].Int>=0)AND (Eqtb↑[4811].Int<16)) THEN Mem[P]↑.Hh .B0←Eqtb↑[4811].Int ELSE Mem[P]↑.Hh.B0← PascalMODPower2Mask[( PascalDIVPower2[C ,8]),15];EXITS Label10 => NULL};EXIT; EXITS Label21 => NULL} ENDLOOP;EXIT; EXITS Label20 => NULL} ENDLOOP; END;--:1151 --1155:-- SetMathChar: PROCEDURE[C: PascalInteger] = BEGIN P:Halfword; IF C>=32768 THEN--1152:--BEGIN CurCs←CurChr+1; CurCmd←Eqtb↑[CurCs].Hh.B0;CurChr←Eqtb↑[CurCs].Hh.Rh;XToken[]; BackInput[]; END--:1152-- ELSE BEGIN P←NewNoad[];Mem[P+1]↑.Hh.Rh←1; Mem[P+1]↑.Hh.B1← PascalMODPower2Mask[C ,255];Mem[P+1]↑.Hh.B0← PascalMODPower2Mask[( PascalDIVPower2[C ,8]),15]; IF C>=28672 THEN BEGIN IF((Eqtb↑[4811].Int>=0)AND (Eqtb↑[4811].Int<16)) THEN Mem[P+1]↑.Hh.B0←Eqtb↑[4811].Int;Mem[P]↑.Hh.B0←16; END ELSE Mem[P]↑.Hh.B0←16+( PascalDIVPower2[C ,12]); Mem[CurList.TailField]↑.Hh.Rh←P;CurList.TailField←P; END; END;--:1155 --1159:-- MathLimitSwitch: PROCEDURE = BEGIN {IF CurList.HeadField#CurList.TailField THEN IF Mem[CurList. TailField]↑.Hh.B0=17 THEN BEGIN Mem[CurList.TailField]↑.Hh.B1←CurChr; GOTO Label10; END;BEGIN IF Interaction=3 THEN NULL;PrintNl[134];Print[983]; END; BEGIN HelpPtr←1;HelpLine↑[0]←984; END;Error[];EXITS Label10 => NULL}; END;--:1159----1160: ScanDelimiter: PROCEDURE[P: Halfword,R: PascalBoolean] = BEGIN IF R THEN ScanTwentySevenBitInt [] ELSE BEGIN--404: DO GetXToken[]; IF(CurCmd#10)AND (CurCmd#0)--:404-- THEN EXIT; ENDLOOP; SELECT CurCmd FROM 11,12 =>CurVal←Eqtb↑[ INT[5073]+CurChr].Int; 15 =>ScanTwentySevenBitInt[]; ENDCASE =>CurVal←-1 ; END; IF CurVal<0 THEN--1161:--BEGIN BEGIN IF Interaction=3 THEN NULL;PrintNl[134]; Print[985]; END;BEGIN HelpPtr←6;HelpLine↑[5]←986;HelpLine↑[4]←987; HelpLine↑[3]←988;HelpLine↑[2]←989;HelpLine↑[1]←990;HelpLine↑[0]←991; END;BackError[];CurVal←0; END--:1161--; Mem[P]↑.Qqqq.B0← PascalMODPower2Mask[( PascalDIVPower2[CurVal ,20]),15]; Mem[P]↑.Qqqq.B1← PascalMODPower2Mask[( PascalDIVPower2[CurVal ,12]),255]; Mem[P]↑.Qqqq.B2← PascalMODPower2Mask[( PascalDIVPower2[CurVal ,8]),15];Mem[P]↑.Qqqq.B3← PascalMODPower2Mask[CurVal ,255]; END;--:1160----1163:-- MathRadical: PROCEDURE = BEGIN BEGIN Mem[CurList.TailField]↑.Hh.Rh←GetNode[5]; CurList.TailField←Mem[CurList.TailField]↑.Hh.Rh; END; Mem[CurList.TailField]↑.Hh.B0←24;Mem[CurList.TailField]↑.Hh.B1←0; Mem[CurList.TailField+1]↑.Hh←EmptyField; Mem[CurList.TailField+3]↑.Hh←EmptyField; Mem[CurList.TailField+2]↑.Hh←EmptyField; ScanDelimiter[CurList.TailField+4,TRUE]; ScanMath[CurList.TailField+1]; END;--:1163----1165:-- MathAc: PROCEDURE = BEGIN IF CurCmd=45 THEN--1166:--BEGIN BEGIN IF Interaction=3 THEN NULL; PrintNl[134];Print[992]; END;PrintEsc[385];Print[993]; BEGIN HelpPtr←2;HelpLine↑[1]←994;HelpLine↑[0]←995; END;Error[]; END--:1166--;BEGIN Mem[CurList.TailField]↑.Hh.Rh←GetNode[5]; CurList.TailField←Mem[CurList.TailField]↑.Hh.Rh; END; Mem[CurList.TailField]↑.Hh.B0←28;Mem[CurList.TailField]↑.Hh.B1←0; Mem[CurList.TailField+1]↑.Hh←EmptyField; Mem[CurList.TailField+3]↑.Hh←EmptyField; Mem[CurList.TailField+2]↑.Hh←EmptyField; Mem[CurList.TailField+4]↑.Hh.Rh←1;ScanFifteenBitInt[]; Mem[CurList.TailField+4]↑.Hh.B1← PascalMODPower2Mask[CurVal ,255]; IF(CurVal>=28672)AND ((Eqtb↑[4811].Int>=0)AND (Eqtb↑[4811].Int<16)) THEN Mem [CurList.TailField+4]↑.Hh.B0←Eqtb↑[4811].Int ELSE Mem[CurList. TailField+4]↑.Hh.B0← PascalMODPower2Mask[( PascalDIVPower2[CurVal ,8]),15]; ScanMath[CurList.TailField+1]; END;--:1165----1172: AppendChoices: PROCEDURE = BEGIN BEGIN Mem[CurList.TailField]↑.Hh.Rh←NewChoice[]; CurList.TailField←Mem[CurList.TailField]↑.Hh.Rh; END; SavePtr←SavePtr+1;SaveStack↑[SavePtr-1].Int←0;ScanLeftBrace[]; PushMath[13]; END;--:1172----1174:----1184: FinMlist: PROCEDURE[P: Halfword] RETURNS[FinMlistResult: Halfword] = BEGIN Q:Halfword; IF CurList.AuxField#0 THEN--1185: BEGIN Mem[CurList.AuxField+3]↑.Hh.Rh←3; Mem[CurList.AuxField+3]↑.Hh.Lh←Mem[CurList.HeadField]↑.Hh.Rh; IF P=0 THEN Q←CurList.AuxField ELSE BEGIN Q←Mem[CurList.AuxField+2 ]↑.Hh.Lh;IF Mem[Q]↑.Hh.B0#30 THEN Confusion[735]; Mem[CurList.AuxField+2]↑.Hh.Lh←Mem[Q]↑.Hh.Rh; Mem[Q]↑.Hh.Rh←CurList.AuxField;Mem[CurList.AuxField]↑.Hh.Rh←P; END; END--:1185-- ELSE BEGIN Mem[CurList.TailField]↑.Hh.Rh←P; Q←Mem[CurList.HeadField]↑.Hh.Rh; END;PopNest[];FinMlistResult←Q; END;--:1184 BuildChoices: PROCEDURE = BEGIN P:Halfword; Unsave[]; P←FinMlist[0]; {SELECT SaveStack↑[SavePtr-1].Int FROM 0 =>Mem[CurList.TailField+1]↑.Hh.Lh←P ;1 =>Mem[CurList.TailField+1]↑.Hh.Rh←P; 2 =>Mem[CurList.TailField+2]↑.Hh.Lh←P; 3 =>BEGIN Mem[CurList.TailField+2]↑.Hh.Rh←P;SavePtr←SavePtr-1; GOTO Label10; END; ENDCASE; SaveStack↑[SavePtr-1].Int←SaveStack↑[SavePtr-1].Int+1; ScanLeftBrace[];PushMath[13];EXITS Label10 => NULL}; END;--:1174----1176:-- SubSup: PROCEDURE = BEGIN T:SmallNumber;P:Halfword; T←0;P←0; IF CurList.TailField#CurList.HeadField THEN IF( INT[Mem[CurList. TailField]↑.Hh.B0]>=16)AND ( INT[Mem[CurList.TailField]↑.Hh.B0]<30) THEN BEGIN P ← INT[CurList.TailField+2]+CurCmd-7;T←Mem[P]↑.Hh.Rh; END; IF(P=0)OR (T#0) THEN--1177: BEGIN BEGIN Mem[CurList.TailField]↑.Hh.Rh←NewNoad[]; CurList.TailField←Mem[CurList.TailField]↑.Hh.Rh; END; P← INT[CurList.TailField+2]+CurCmd-7; IF T#0 THEN BEGIN IF CurCmd=7 THEN BEGIN BEGIN IF Interaction=3 THEN NULL; PrintNl[134];Print[996]; END;BEGIN HelpPtr←1;HelpLine↑[0]←997; END; END ELSE BEGIN BEGIN IF Interaction=3 THEN NULL;PrintNl[134];Print[998]; END; BEGIN HelpPtr←1;HelpLine↑[0]←999; END; END;Error[]; END; END--:1177--; ScanMath[P]; END;--:1176----1181:-- MathFraction: PROCEDURE = BEGIN C:SmallNumber; C←CurChr;IF CurList.AuxField#0 THEN--1183: BEGIN IF INT[C]>=3 THEN BEGIN ScanDelimiter[64988,FALSE]; ScanDelimiter[64988,FALSE]; END; IF C MOD 3=0 THEN ScanDimen[FALSE,FALSE,FALSE]; BEGIN IF Interaction=3 THEN NULL;PrintNl[134];Print[1006]; END; BEGIN HelpPtr←3;HelpLine↑[2]←1007;HelpLine↑[1]←1008; HelpLine↑[0]←1009; END;Error[]; END--:1183 ELSE BEGIN CurList.AuxField←GetNode[6]; Mem[CurList.AuxField]↑.Hh.B0←25;Mem[CurList.AuxField]↑.Hh.B1←0; Mem[CurList.AuxField+2]↑.Hh.Rh←3; Mem[CurList.AuxField+2]↑.Hh.Lh←Mem[CurList.HeadField]↑.Hh.Rh; Mem[CurList.AuxField+3]↑.Hh←EmptyField; Mem[CurList.AuxField+4]↑.Qqqq←NullDelimiter; Mem[CurList.AuxField+5]↑.Qqqq←NullDelimiter; Mem[CurList.HeadField]↑.Hh.Rh←0; CurList.TailField←CurList.HeadField;--1182: IF INT[C]>=3 THEN BEGIN ScanDelimiter[CurList.AuxField+4,FALSE]; ScanDelimiter[CurList.AuxField+5,FALSE]; END; SELECT C MOD 3 FROM 0 =>BEGIN ScanDimen[FALSE,FALSE,FALSE]; Mem[CurList.AuxField+1]↑.Int←CurVal; END; 1 =>Mem[CurList.AuxField+1]↑.Int←1073741824; 2 =>Mem[CurList.AuxField+1]↑.Int←0; ENDCASE--:1182--; END; END;--:1181----1191: MathLeftRight: PROCEDURE = BEGIN T:SmallNumber;P:Halfword; T←CurChr;IF(T=31)AND (CurGroup#16) THEN--1192: BEGIN IF CurGroup=15 THEN BEGIN ScanDelimiter[64988,FALSE]; BEGIN IF Interaction=3 THEN NULL;PrintNl[134];Print[636]; END;PrintEsc[735]; BEGIN HelpPtr←1;HelpLine↑[0]←1010; END;Error[]; END ELSE OffSave[]; END--:1192-- ELSE BEGIN P←NewNoad[];Mem[P]↑.Hh.B0←T; ScanDelimiter[P+1,FALSE];IF T=30 THEN BEGIN PushMath[16]; Mem[CurList.HeadField]↑.Hh.Rh←P;CurList.TailField←P; END ELSE BEGIN P←FinMlist[P];Unsave[]; BEGIN Mem[CurList.TailField]↑.Hh.Rh←NewNoad[]; CurList.TailField←Mem[CurList.TailField]↑.Hh.Rh; END; Mem[CurList.TailField]↑.Hh.B0←23;Mem[CurList.TailField+1]↑.Hh.Rh←3; Mem[CurList.TailField+1]↑.Hh.Lh←P; END; END; END;--:1191----1194: AfterMath: PROCEDURE = BEGIN L:PascalBoolean;Danger:PascalBoolean;M:PascalInteger;P:Halfword; A:Halfword;--1198:--B:Halfword;W:Scaled;Z:Scaled;E:Scaled;Q:Scaled; D:Scaled;S:Scaled;G1, G2:SmallNumber;R:Halfword;T:Halfword;--:1198 Danger←FALSE;--1195: IF( INT[FontParams↑[Eqtb↑[4081].Hh.Rh]]<22)OR ( INT[FontParams↑[Eqtb↑[4097].Hh.Rh]]<22) OR ( INT[FontParams↑[Eqtb↑[4113].Hh.Rh]]<22) THEN BEGIN BEGIN IF Interaction=3 THEN NULL;PrintNl[134];Print[1011]; END;BEGIN HelpPtr←3;HelpLine↑[2]←1012; HelpLine↑[1]←1013;HelpLine↑[0]←1014; END;Error[];FlushMath[];Danger←TRUE; END ELSE IF( INT[FontParams↑[Eqtb↑[4082].Hh.Rh]]<13)OR ( INT[FontParams↑[Eqtb↑[4098]. Hh.Rh]]<13)OR ( INT[FontParams↑[Eqtb↑[4114].Hh.Rh]]<13) THEN BEGIN BEGIN IF Interaction=3 THEN NULL;PrintNl[134];Print[1015]; END;BEGIN HelpPtr←3; HelpLine↑[2]←1016;HelpLine↑[1]←1017;HelpLine↑[0]←1018; END;Error[]; FlushMath[];Danger←TRUE; END--:1195--;M←CurList.ModeField;L←FALSE; P←FinMlist[0];IF CurList.ModeField=-M THEN BEGIN CurMlist←P; CurStyle←2;MlistPenalties←FALSE;MlistToHlist[]; A←Hpack[Mem[64997]↑.Hh.Rh,0,1];Unsave[];SavePtr←SavePtr-1; IF SaveStack↑[SavePtr+0].Int=1 THEN L←TRUE;IF Danger THEN FlushMath[]; M←CurList.ModeField;P←FinMlist[0]; END ELSE A←0;IF M<0 THEN--1196: BEGIN BEGIN Mem[CurList.TailField]↑.Hh.Rh←NewMath[Eqtb↑[5202].Int,0]; CurList.TailField←Mem[CurList.TailField]↑.Hh.Rh; END;CurMlist←P; CurStyle←2;MlistPenalties←( INT[CurList.ModeField]>0);MlistToHlist[]; Mem[CurList.TailField]↑.Hh.Rh←Mem[64997]↑.Hh.Rh; WHILE Mem[CurList.TailField]↑.Hh.Rh#0 DO CurList.TailField←Mem[ CurList.TailField]↑.Hh.Rh ENDLOOP ; BEGIN Mem[CurList.TailField]↑.Hh.Rh←NewMath[Eqtb↑[5202].Int,1]; CurList.TailField←Mem[CurList.TailField]↑.Hh.Rh; END; CurList.AuxField←1000;Unsave[]; END--:1196-- ELSE BEGIN--1197: BEGIN GetXToken[];IF CurCmd#3 THEN BEGIN BEGIN IF Interaction=3 THEN NULL; PrintNl[134];Print[1019]; END;BEGIN HelpPtr←2;HelpLine↑[1]←1020; HelpLine↑[0]←1021; END;BackError[]; END; END--:1197--;--1199:--CurMlist←P; CurStyle←0;MlistPenalties←FALSE;MlistToHlist[];P←Mem[64997]↑.Hh.Rh; AdjustTail←64995;B←Hpack[P,0,1];T←AdjustTail;AdjustTail←0; W←Mem[B+1]↑.Int;Z←Eqtb↑[5215].Int;S←Eqtb↑[5216].Int; IF (A=0)OR Danger THEN BEGIN E←0;Q←0; END ELSE BEGIN E←Mem[A+1]↑.Int; Q←E+FontInfo↑[6+ParamBase↑[Eqtb↑[4081].Hh.Rh]].Int; END; IF W+Q>Z THEN--1201: BEGIN IF(E#0)AND ((W-TotalShrink↑[0]+Q<=Z)OR (TotalShrink↑[1]#0)OR ( TotalShrink↑[2]#0)OR (TotalShrink↑[3]#0)) THEN BEGIN FreeNode[B,7]; B←Hpack[P,Z-Q,0]; END ELSE BEGIN E←0;IF W>Z THEN BEGIN FreeNode[B,7]; B←Hpack[P,Z,0]; END; END;W←Mem[B+1]↑.Int; END--:1201--;--1202:--D←Half[Z-W]; IF(E>0)AND (D<2*E) THEN BEGIN D←Half[Z-W-E]; IF P#0 THEN IF Mem[P]↑.Hh.B0=10 THEN D←0; END--:1202--;--1203: BEGIN Mem[CurList.TailField]↑.Hh.Rh←NewPenalty[Eqtb↑[4778].Int]; CurList.TailField←Mem[CurList.TailField]↑.Hh.Rh; END; IF (D+S<=Eqtb↑[5214].Int)OR L THEN BEGIN G1←3;G2←4; END ELSE BEGIN G1←5; G2←6; END;IF L AND (E=0) THEN BEGIN Mem[A+4]↑.Int←S;AppendToVlist[A]; BEGIN Mem[CurList.TailField]↑.Hh.Rh←NewPenalty[10000]; CurList.TailField←Mem[CurList.TailField]↑.Hh.Rh; END; END ELSE BEGIN Mem[CurList.TailField]↑.Hh.Rh←NewParamGlue[G1]; CurList.TailField←Mem[CurList.TailField]↑.Hh.Rh; END--:1203--;--1204: IF E#0 THEN BEGIN R←NewKern[Z-W-E-D];IF L THEN BEGIN Mem[A]↑.Hh.Rh←R; Mem[R]↑.Hh.Rh←B;B←A;D←0; END ELSE BEGIN Mem[B]↑.Hh.Rh←R; Mem[R]↑.Hh.Rh←A; END;B←Hpack[B,0,1]; END;Mem[B+4]↑.Int←S+D; AppendToVlist[B]; IF T#64995 THEN BEGIN Mem[CurList.TailField]↑.Hh.Rh←Mem[64995]↑.Hh.Rh; CurList.TailField←T; END--:1204--;--1205: IF (A#0)AND (E=0)AND NOT L THEN BEGIN BEGIN Mem[CurList.TailField]↑.Hh. Rh←NewPenalty[10000]; CurList.TailField←Mem[CurList.TailField]↑.Hh.Rh; END; Mem[A+4]↑.Int←S+Z-Mem[A+1]↑.Int;AppendToVlist[A]; BEGIN Mem[CurList.TailField]↑.Hh.Rh←NewPenalty[Eqtb↑[4779].Int]; CurList.TailField←Mem[CurList.TailField]↑.Hh.Rh; END; END ELSE BEGIN BEGIN Mem[CurList.TailField]↑.Hh.Rh←NewPenalty[Eqtb↑ [4779].Int];CurList.TailField←Mem[CurList.TailField]↑.Hh.Rh; END; BEGIN Mem[CurList.TailField]↑.Hh.Rh←NewParamGlue[G2]; CurList.TailField←Mem[CurList.TailField]↑.Hh.Rh; END; END--:1205--; ResumeAfterDisplay--:1199--[]; END; END;--:1194----1200: END.