-- file: TexMath2Impl.mesa
-- Pascal-to-Mesa translator output, translated at September 27, 1985 10:21:38 am PDT


DIRECTORY
  PascalBasic,
  TexTypes,
  TexInteraction,
  TexMath,
  TexMemory,
  TexSymbols,
  TexOps,
  TexSysdepInline;

TexMath2Impl: PROGRAM IMPORTS PascalBasic, TexInteraction, TexMemory, TexSymbols, TexOps, TexSysdepInline EXPORTS TexMath = PUBLIC
BEGIN OPEN PascalBasic, TexTypes, TexInteraction, TexMath, TexMemory, TexSymbols, TexOps, TexSysdepInline;
--704:-- FractionRule: PROCEDURE[T: Scaled] RETURNS[FractionRuleResult: Halfword] = 
BEGIN P:Halfword;
 P←NewRule[];Mem[P+3]↑.Int←T;Mem[P+2]↑.Int←0;FractionRuleResult←P; END;
--:704----705:-- Overbar: PROCEDURE[B: Halfword,K,T: Scaled] RETURNS[OverbarResult: Halfword]
 = 
BEGIN P, Q:Halfword; P←NewKern[K];Mem[P]↑.Hh.Rh←B;
Q←FractionRule[T];Mem[Q]↑.Hh.Rh←P;P←NewKern[T];Mem[P]↑.Hh.Rh←Q;
OverbarResult←Vpackage[P,0,1,1073741823]; END;--:705----706:----709:
--:715----716:-- MathGlue: PROCEDURE[G: Halfword,M: Scaled] RETURNS[MathGlueResult: Halfword]
 = 
BEGIN P:Halfword;N:PascalInteger;F:Scaled; N←XOverN[M,65536];
F←Remainder;P←GetNode[4];
Mem[P+1]↑.Int←NxPlusY[N,Mem[G+1]↑.Int,XnOverD[Mem[G+1]↑.Int,F,65536]];
Mem[P]↑.Hh.B0←Mem[G]↑.Hh.B0;
IF Mem[P]↑.Hh.B0=0  THEN Mem[P+2]↑.Int←NxPlusY[N,Mem[G+2]↑.Int,XnOverD[
Mem[G+2]↑.Int,F,65536]] ELSE Mem[P+2]↑.Int←Mem[G+2]↑.Int;
Mem[P]↑.Hh.B1←Mem[G]↑.Hh.B1;
IF Mem[P]↑.Hh.B1=0  THEN Mem[P+3]↑.Int←NxPlusY[N,Mem[G+3]↑.Int,XnOverD[
Mem[G+3]↑.Int,F,65536]] ELSE Mem[P+3]↑.Int←Mem[G+3]↑.Int;MathGlueResult←P; END;
--:716----717:-- MathKern: PROCEDURE[P: Halfword,M: Scaled] = 
BEGIN N:PascalInteger;
F:Scaled; IF Mem[P]↑.Hh.B1=99  THEN BEGIN N←XOverN[M,65536];
F←Remainder;
Mem[P+1]↑.Int←NxPlusY[N,Mem[P+1]↑.Int,XnOverD[Mem[P+1]↑.Int,F,65536]];
Mem[P]↑.Hh.B1←0; END; END;--:717----718:-- MakeOver: PROCEDURE[Q: Halfword]
 = 
BEGIN Mem[Q+1]↑.Hh.Lh←Overbar[CleanBox[Q+1,2*( PascalDIVPower2[CurStyle ,1])+1],
3*FontInfo↑[8+ParamBase↑[Eqtb↑[4082+CurSize].Hh.Rh]].Int,FontInfo↑[
8+ParamBase↑[Eqtb↑[4082+CurSize].Hh.Rh]].Int];Mem[Q+1]↑.Hh.Rh←2; END;--:734
--735:-- MakeUnder: PROCEDURE[Q: Halfword] = 
BEGIN P, X, Y:Halfword;Delta:Scaled;
 X←CleanBox[Q+1,CurStyle];
P←NewKern[3*FontInfo↑[8+ParamBase↑[Eqtb↑[4082+CurSize].Hh.Rh]].Int];
Mem[X]↑.Hh.Rh←P;
Mem[P]↑.Hh.Rh←FractionRule[FontInfo↑[8+ParamBase↑[Eqtb↑[4082+CurSize].
Hh.Rh]].Int];Y←Vpackage[X,0,1,1073741823];
Delta←Mem[Y+3]↑.Int+Mem[Y+2]↑.Int+FontInfo↑[8+ParamBase↑[Eqtb↑[
4082+CurSize].Hh.Rh]].Int;Mem[Y+3]↑.Int←Mem[X+3]↑.Int;
Mem[Y+2]↑.Int←Delta-Mem[Y+3]↑.Int;Mem[Q+1]↑.Hh.Lh←Y;Mem[Q+1]↑.Hh.Rh←2;
 END;--:735----736:-- MakeVcenter: PROCEDURE[Q: Halfword] = 
BEGIN V:Halfword;
Delta:Scaled; V←Mem[Q+1]↑.Hh.Lh;
IF Mem[V]↑.Hh.B0#1  THEN Confusion[400];Delta←Mem[V+3]↑.Int+Mem[V+2]↑.Int;
Mem[V+3]↑.Int←
FontInfo↑[22+ParamBase↑[Eqtb↑[4081+CurSize].Hh.Rh]].Int+Half[Delta];Mem[V+2]↑.Int←Delta-Mem[V+3]↑.Int; END;--:736----737:
 MakeOp: PROCEDURE[Q: Halfword] RETURNS[MakeOpResult: Scaled] = 
BEGIN Delta:Scaled;P, V, X, Y, Z:Halfword;
ShiftUp, ShiftDown:Scaled;
 IF(Mem[Q]↑.Hh.B1=0)AND ( INT[CurStyle]<2) THEN Mem[Q]↑.Hh.B1←1;
IF Mem[Q+1]↑.Hh.Rh=1  THEN BEGIN Fetch[Q+1];
IF( INT[CurStyle]<2)AND (( PascalMODPower2Mask[(CurI.B2),3])=2) THEN BEGIN CurC←CurI.B3;
Mem[Q+1]↑.Hh.B1←CurC;CurI←FontInfo↑[CharBase↑[CurF]+CurC].Qqqq; END;
Delta←FontInfo↑[ ItalicBase↑[CurF]+PascalDIVPower2[(CurI.B2),2]].Int;
X←CleanBox[Q+1,CurStyle];
IF(Mem[Q+3]↑.Hh.Rh#0)AND (Mem[Q]↑.Hh.B1#1) THEN Mem[X+1]↑.Int←Mem[X+1]↑.Int
-Delta;
Mem[X+4]↑.Int←Half[Mem[X+3]↑.Int-Mem[X+2]↑.Int]-FontInfo↑[22+ParamBase↑
[Eqtb↑[4081+CurSize].Hh.Rh]].Int;Mem[Q+1]↑.Hh.Rh←2;Mem[Q+1]↑.Hh.Lh←X;
 END  ELSE Delta←0;IF Mem[Q]↑.Hh.B1=1  THEN--750:
BEGIN X←CleanBox[Q+2,2*( PascalDIVPower2[CurStyle ,2])+4+( PascalMODPower2Mask[CurStyle ,1])];
Y←CleanBox[Q+1,CurStyle];Z←CleanBox[Q+3,2*( PascalDIVPower2[CurStyle ,2])+5];
V←NewNullBox[];Mem[V]↑.Hh.B0←1;Mem[V+1]↑.Int←Mem[Y+1]↑.Int;
IF Mem[X+1]↑.Int>Mem[V+1]↑.Int  THEN Mem[V+1]↑.Int←Mem[X+1]↑.Int;
IF Mem[Z+1]↑.Int>Mem[V+1]↑.Int  THEN Mem[V+1]↑.Int←Mem[Z+1]↑.Int;
X←Rebox[X,Mem[V+1]↑.Int];Y←Rebox[Y,Mem[V+1]↑.Int];
Z←Rebox[Z,Mem[V+1]↑.Int];Mem[X+4]↑.Int←Half[Delta];
Mem[Z+4]↑.Int←-Mem[X+4]↑.Int;Mem[V+3]↑.Int←Mem[Y+3]↑.Int;
Mem[V+2]↑.Int←Mem[Y+2]↑.Int;--751:
IF Mem[Q+2]↑.Hh.Rh=0  THEN BEGIN FreeNode[X,7];Mem[V+5]↑.Hh.Rh←Y;
 END  ELSE BEGIN ShiftUp←FontInfo↑[11+ParamBase↑[Eqtb↑[4082+CurSize].Hh.
Rh]].Int-Mem[X+2]↑.Int;
IF ShiftUp<FontInfo↑[9+ParamBase↑[Eqtb↑[4082+CurSize].Hh.Rh]].Int  THEN
ShiftUp←FontInfo↑[9+ParamBase↑[Eqtb↑[4082+CurSize].Hh.Rh]].Int;
P←NewKern[ShiftUp];Mem[P]↑.Hh.Rh←Y;Mem[X]↑.Hh.Rh←P;
P←NewKern[FontInfo↑[13+ParamBase↑[Eqtb↑[4082+CurSize].Hh.Rh]].Int];
Mem[P]↑.Hh.Rh←X;Mem[V+5]↑.Hh.Rh←P;
Mem[V+3]↑.Int←Mem[V+3]↑.Int+FontInfo↑[13+ParamBase↑[Eqtb↑[4082+CurSize].
Hh.Rh]].Int+Mem[X+3]↑.Int+Mem[X+2]↑.Int+ShiftUp; END;
IF Mem[Q+3]↑.Hh.Rh=0  THEN FreeNode[Z,7] ELSE BEGIN ShiftDown←FontInfo↑
[12+ParamBase↑[Eqtb↑[4082+CurSize].Hh.Rh]].Int-Mem[Z+3]↑.Int;
IF ShiftDown<FontInfo↑[10+ParamBase↑[Eqtb↑[4082+CurSize].Hh.Rh]].Int
 THEN ShiftDown←FontInfo↑[10+ParamBase↑[Eqtb↑[4082+CurSize].Hh.Rh]].Int
;P←NewKern[ShiftDown];Mem[Y]↑.Hh.Rh←P;Mem[P]↑.Hh.Rh←Z;
P←NewKern[FontInfo↑[13+ParamBase↑[Eqtb↑[4082+CurSize].Hh.Rh]].Int];
Mem[Z]↑.Hh.Rh←P;
Mem[V+2]↑.Int←Mem[V+2]↑.Int+FontInfo↑[13+ParamBase↑[Eqtb↑[4082+CurSize].
Hh.Rh]].Int+Mem[Z+3]↑.Int+Mem[Z+2]↑.Int+ShiftDown; END--:751--;
Mem[Q+1]↑.Int←V; END--:750--;MakeOpResult←Delta; END;--:749----752:

END.