-- file: MFMovesImpl.mesa -- Pascal-to-Mesa translator output, translated at October 31, 1985 4:28:01 pm PST DIRECTORY PascalBasic, PascalWizardFiles, MFTypes, MFInteraction, MFMath, MFMoves; MFMovesImpl: PROGRAM IMPORTS PascalBasic, MFInteraction, MFMath EXPORTS MFMoves = PUBLIC BEGIN OPEN PascalBasic, PascalWizardFiles, MFTypes, MFInteraction, MFMath, MFMoves; --:298----308: Move: LONG POINTER TO ARRAY PascalInteger[0..5000] OF PascalInteger _ PascalStaticZone.NEW[ARRAY PascalInteger[0..5000] OF PascalInteger]; MovePtr: PascalInteger[0..MoveSize]; --:308----309: BisectStack: LONG POINTER TO ARRAY PascalInteger[0..785] OF PascalInteger _ PascalStaticZone.NEW[ARRAY PascalInteger[0..785] OF PascalInteger]; BisectPtr: PascalInteger[0..BistackSize]; --:269----311:-- MakeMoves: PROCEDURE[Xx0,Xx1,Xx2,Xx3,Yy0,Yy1,Yy2,Yy3: Scaled, XiCorr,EtaCorr: SmallNumber] = BEGIN X1, X2, X3, M, R, Y1, Y2, Y3, N, S, L:PascalInteger;Q, T, U, X2a, X3a, Y2a, Y3a:PascalInteger; IF(Xx3=XiCorr THEN R_ PascalMODPower2Mask[(Xx0-XiCorr),65535] ELSE R_65535-( PascalMODPower2Mask[( -Xx0+XiCorr-1),65535]);M_ PascalDIVPower2[(Xx3-Xx0+R),16];Y1_Yy1-Yy0;Y2_Yy2-Yy1; Y3_Yy3-Yy2; IF Yy0>=EtaCorr THEN S_ PascalMODPower2Mask[(Yy0-EtaCorr),65535] ELSE S_65535-( PascalMODPower2Mask[( -Yy0+EtaCorr-1),65535]);N_ PascalDIVPower2[(Yy3-Yy0+S),16]; IF(Xx3-Xx0>=268435456)OR (Yy3-Yy0>=268435456) THEN--313: BEGIN X1_ PascalDIVPower2[(X1+XiCorr),1];X2_ PascalDIVPower2[(X2+XiCorr),1];X3_ PascalDIVPower2[(X3+XiCorr),1]; R_ PascalDIVPower2[(R+XiCorr),1];Y1_ PascalDIVPower2[(Y1+EtaCorr),1];Y2_ PascalDIVPower2[(Y2+EtaCorr),1]; Y3_ PascalDIVPower2[(Y3+EtaCorr),1];S_ PascalDIVPower2[(S+EtaCorr),1];L_15; END--:313--; {WHILE TRUE DO BEGIN DO {--Label22:----314:--IF M=0 THEN--315: WHILE N>0 DO BEGIN MovePtr_MovePtr+1;Move^[MovePtr]_1;N_N-1; END--:315-- ENDLOOP ELSE IF N=0 THEN--316:--Move^[MovePtr]_Move^[MovePtr]+M--:316 ELSE IF M+N=2 THEN--317:--BEGIN R_TwoToThe^[L]-R;S_TwoToThe^[L]-S; {WHILE L<30 DO BEGIN X3a_X3;X2a_ PascalDIVPower2[(X2+X3+XiCorr),1]; X2_ PascalDIVPower2[(X1+X2+XiCorr),1];X3_ PascalDIVPower2[(X2+X2a+XiCorr),1];T_X1+X2+X3; R_R+R-XiCorr;Y3a_Y3;Y2a_ PascalDIVPower2[(Y2+Y3+EtaCorr),1]; Y2_ PascalDIVPower2[(Y1+Y2+EtaCorr),1];Y3_ PascalDIVPower2[(Y2+Y2a+EtaCorr),1];U_Y1+Y2+Y3; S_S+S-EtaCorr;IF T=0 THEN--319: BEGIN Move^[MovePtr]_Move^[MovePtr]+1;MovePtr_MovePtr+1; Move^[MovePtr]_1; END--:319-- ELSE--320:--BEGIN MovePtr_MovePtr+1; Move^[MovePtr]_2; END--:320--;EXITS Label30 => NULL}; END--:317-- ELSE BEGIN L_L+1; BisectStack^[BisectPtr+10]_L;BisectStack^[BisectPtr+2]_X3; BisectStack^[BisectPtr+1]_ PascalDIVPower2[(X2+X3+XiCorr),1]; X2_ PascalDIVPower2[(X1+X2+XiCorr),1]; X3_ PascalDIVPower2[(X2+BisectStack^[BisectPtr+1]+XiCorr),1]; BisectStack^[BisectPtr]_X3;R_R+R+XiCorr;T_X1+X2+X3+R; Q_ T /TwoToThe^[L];BisectStack^[BisectPtr+3]_ T MOD TwoToThe^[L]; BisectStack^[BisectPtr+4]_M-Q;M_Q;BisectStack^[BisectPtr+7]_Y3; BisectStack^[BisectPtr+6]_ PascalDIVPower2[(Y2+Y3+EtaCorr),1]; Y2_ PascalDIVPower2[(Y1+Y2+EtaCorr),1]; Y3_ PascalDIVPower2[(Y2+BisectStack^[BisectPtr+6]+EtaCorr),1]; BisectStack^[BisectPtr+5]_Y3;S_S+S+EtaCorr;U_Y1+Y2+Y3+S; Q_ U /TwoToThe^[L];BisectStack^[BisectPtr+8]_ U MOD TwoToThe^[L]; BisectStack^[BisectPtr+9]_N-Q;N_Q;BisectPtr_BisectPtr+11; GOTO Label22; END--:314--;IF BisectPtr=0 THEN GOTO Label10;--312:--BisectPtr_BisectPtr-11; X1_BisectStack^[BisectPtr];X2_BisectStack^[BisectPtr+1]; X3_BisectStack^[BisectPtr+2];R_BisectStack^[BisectPtr+3]; M_BisectStack^[BisectPtr+4];Y1_BisectStack^[BisectPtr+5]; Y2_BisectStack^[BisectPtr+6];Y3_BisectStack^[BisectPtr+7]; S_BisectStack^[BisectPtr+8];N_BisectStack^[BisectPtr+9]; L_BisectStack^[BisectPtr+10]--:312--;EXIT; EXITS Label22 => NULL} ENDLOOP; END ENDLOOP ;EXITS Label10 => NULL}; END;--:311----321: SmoothMoves: PROCEDURE[B,T: PascalInteger] = BEGIN K:PascalInteger[1..MoveSize];A, Aa, Aaa:PascalInteger; IF T-B>=3 THEN BEGIN K_B+2;Aa_Move^[K-1];Aaa_Move^[K-2]; DO A_Move^[K];IF ABS[A-Aa]>1 THEN--322: IF A>Aa THEN BEGIN IF Aaa>=Aa THEN IF A>=Move^[K+1] THEN BEGIN Move^[K-1]_ Move^[K-1]+1;Move^[K]_A-1; END; END ELSE BEGIN IF Aaa<=Aa THEN IF A<=Move^[K+1] THEN BEGIN Move^[K-1]_Move ^[K-1]-1;Move^[K]_A+1; END; END--:322--;K_K+1;Aaa_Aa;Aa_A; IF K=T THEN EXIT; ENDLOOP; END; END;--:321----326:-- END.