-- file: MFTimeImpl2.mesa
-- Pascal-to-Mesa translator output, translated at October 31, 1985 4:28:02 pm PST
DIRECTORY
PascalBasic,
PascalWizardFiles,
MFTypes,
MFProcArray,
MFMoves,
MFTime;
MFTimeImpl2: PROGRAM IMPORTS PascalBasic, MFProcArray, MFMoves, MFTime EXPORTS MFTime = PUBLIC
BEGIN OPEN PascalBasic, PascalWizardFiles, MFTypes, MFProcArray, MFMoves, MFTime;
CubicIntersection: PROCEDURE[P,Pp: Halfword] =
BEGIN
Q, Qq:Halfword;--558:-- CIInit1: PROCEDURE =
BEGIN Q←Mem[P]↑.Hh.Rh;
Qq←Mem[Pp]↑.Hh.Rh;BisectPtr←20;
BisectStack↑[BisectPtr-5]←Mem[ INT[P]+5]↑.Int-Mem[ INT[P]+1]↑.Int;
BisectStack↑[BisectPtr-4]←Mem[ INT[Q]+3]↑.Int-Mem[ INT[P]+5]↑.Int;
BisectStack↑[BisectPtr-3]←Mem[ INT[Q]+1]↑.Int-Mem[ INT[Q]+3]↑.Int;
IF BisectStack↑[BisectPtr-5]<0 THEN IF BisectStack↑[BisectPtr-3]>=0
THEN BEGIN IF BisectStack↑[BisectPtr-4]<0 THEN BisectStack↑[BisectPtr
-2]←BisectStack↑[BisectPtr-5]+BisectStack↑[BisectPtr-4] ELSE
BisectStack↑[BisectPtr-2]←BisectStack↑[BisectPtr-5];
BisectStack↑[BisectPtr-1]←BisectStack↑[BisectPtr-5]+BisectStack↑
[BisectPtr-4]+BisectStack↑[BisectPtr-3];
IF BisectStack↑[BisectPtr-1]<0 THEN BisectStack↑[BisectPtr-1]←0;
END ELSE BEGIN BisectStack↑[BisectPtr-2]←
BisectStack↑[BisectPtr-5]+BisectStack↑[BisectPtr-4]+BisectStack↑[BisectPtr-3];
IF BisectStack↑[BisectPtr-2]>BisectStack↑[BisectPtr-5] THEN
BisectStack↑[BisectPtr-2]←BisectStack↑[BisectPtr-5];
BisectStack↑[BisectPtr-1]←BisectStack↑[BisectPtr-5]+BisectStack↑
[BisectPtr-4];
IF BisectStack↑[BisectPtr-1]<0 THEN BisectStack↑[BisectPtr-1]←0;
END ELSE IF BisectStack↑[BisectPtr-3]<=0 THEN BEGIN IF BisectStack↑
[BisectPtr-4]>0 THEN BisectStack↑[BisectPtr-1]←BisectStack↑[BisectPtr
-5]+BisectStack↑[BisectPtr-4] ELSE BisectStack↑[BisectPtr-1]←
BisectStack↑[BisectPtr-5];
BisectStack↑[BisectPtr-2]←BisectStack↑[BisectPtr-5]+BisectStack↑
[BisectPtr-4]+BisectStack↑[BisectPtr-3];
IF BisectStack↑[BisectPtr-2]>0 THEN BisectStack↑[BisectPtr-2]←0;
END ELSE BEGIN BisectStack↑[BisectPtr-1]←
BisectStack↑[BisectPtr-5]+BisectStack↑[BisectPtr-4]+BisectStack↑[BisectPtr-3];
IF BisectStack↑[BisectPtr-1]<BisectStack↑[BisectPtr-5] THEN
BisectStack↑[BisectPtr-1]←BisectStack↑[BisectPtr-5];
BisectStack↑[BisectPtr-2]←BisectStack↑[BisectPtr-5]+BisectStack↑
[BisectPtr-4];
IF BisectStack↑[BisectPtr-2]>0 THEN BisectStack↑[BisectPtr-2]←0; END;
BisectStack↑[BisectPtr-10]←Mem[ INT[P]+6]↑.Int-Mem[ INT[P]+2]↑.Int;
BisectStack↑[BisectPtr-9]←Mem[ INT[Q]+4]↑.Int-Mem[ INT[P]+6]↑.Int;
BisectStack↑[BisectPtr-8]←Mem[ INT[Q]+2]↑.Int-Mem[ INT[Q]+4]↑.Int;
IF BisectStack↑[BisectPtr-10]<0 THEN IF BisectStack↑[BisectPtr-8]>=0
THEN BEGIN IF BisectStack↑[BisectPtr-9]<0 THEN BisectStack↑[BisectPtr
-7]←BisectStack↑[BisectPtr-10]+BisectStack↑[BisectPtr-9] ELSE
BisectStack↑[BisectPtr-7]←BisectStack↑[BisectPtr-10];
BisectStack↑[BisectPtr-6]←BisectStack↑[BisectPtr-10]+BisectStack↑
[BisectPtr-9]+BisectStack↑[BisectPtr-8];
IF BisectStack↑[BisectPtr-6]<0 THEN BisectStack↑[BisectPtr-6]←0;
END ELSE BEGIN BisectStack↑[BisectPtr-7]←
BisectStack↑[BisectPtr-10]+BisectStack↑[BisectPtr-9]+BisectStack↑[BisectPtr-8];
IF BisectStack↑[BisectPtr-7]>BisectStack↑[BisectPtr-10] THEN
BisectStack↑[BisectPtr-7]←BisectStack↑[BisectPtr-10];
BisectStack↑[BisectPtr-6]←BisectStack↑[BisectPtr-10]+BisectStack↑
[BisectPtr-9];
IF BisectStack↑[BisectPtr-6]<0 THEN BisectStack↑[BisectPtr-6]←0;
END ELSE IF BisectStack↑[BisectPtr-8]<=0 THEN BEGIN IF BisectStack↑
[BisectPtr-9]>0 THEN BisectStack↑[BisectPtr-6]←BisectStack↑[BisectPtr
-10]+BisectStack↑[BisectPtr-9] ELSE BisectStack↑[BisectPtr-6]←
BisectStack↑[BisectPtr-10];
BisectStack↑[BisectPtr-7]←BisectStack↑[BisectPtr-10]+BisectStack↑
[BisectPtr-9]+BisectStack↑[BisectPtr-8];
IF BisectStack↑[BisectPtr-7]>0 THEN BisectStack↑[BisectPtr-7]←0;
END ELSE BEGIN BisectStack↑[BisectPtr-6]←
BisectStack↑[BisectPtr-10]+BisectStack↑[BisectPtr-9]+BisectStack↑[BisectPtr-8];
IF BisectStack↑[BisectPtr-6]<BisectStack↑[BisectPtr-10] THEN
BisectStack↑[BisectPtr-6]←BisectStack↑[BisectPtr-10];
BisectStack↑[BisectPtr-7]←BisectStack↑[BisectPtr-10]+BisectStack↑
[BisectPtr-9];
IF BisectStack↑[BisectPtr-7]>0 THEN BisectStack↑[BisectPtr-7]←0; END;
END; CIInit2: PROCEDURE
=
BEGIN BisectStack↑[BisectPtr-15]←Mem[ INT[Pp]+5]↑.Int-Mem[ INT[Pp]+1]↑.Int;
BisectStack↑[BisectPtr-14]←Mem[ INT[Qq]+3]↑.Int-Mem[ INT[Pp]+5]↑.Int;
BisectStack↑[BisectPtr-13]←Mem[ INT[Qq]+1]↑.Int-Mem[ INT[Qq]+3]↑.Int;
IF BisectStack↑[BisectPtr-15]<0 THEN IF BisectStack↑[BisectPtr-13]>=0
THEN BEGIN IF BisectStack↑[BisectPtr-14]<0 THEN BisectStack↑[BisectPtr
-12]←BisectStack↑[BisectPtr-15]+BisectStack↑[BisectPtr-14] ELSE
BisectStack↑[BisectPtr-12]←BisectStack↑[BisectPtr-15];
BisectStack↑[BisectPtr-11]←BisectStack↑[BisectPtr-15]+BisectStack↑
[BisectPtr-14]+BisectStack↑[BisectPtr-13];
IF BisectStack↑[BisectPtr-11]<0 THEN BisectStack↑[BisectPtr-11]←0;
END ELSE BEGIN BisectStack↑[BisectPtr-12]←
BisectStack↑[BisectPtr-15]+BisectStack↑[BisectPtr-14]+BisectStack↑[BisectPtr-13];
IF BisectStack↑[BisectPtr-12]>BisectStack↑[BisectPtr-15] THEN
BisectStack↑[BisectPtr-12]←BisectStack↑[BisectPtr-15];
BisectStack↑[BisectPtr-11]←BisectStack↑[BisectPtr-15]+BisectStack↑
[BisectPtr-14];
IF BisectStack↑[BisectPtr-11]<0 THEN BisectStack↑[BisectPtr-11]←0;
END ELSE IF BisectStack↑[BisectPtr-13]<=0 THEN BEGIN IF BisectStack↑
[BisectPtr-14]>0 THEN BisectStack↑[BisectPtr-11]←BisectStack↑
[BisectPtr-15]+BisectStack↑[BisectPtr-14] ELSE BisectStack↑[BisectPtr
-11]←BisectStack↑[BisectPtr-15];
BisectStack↑[BisectPtr-12]←BisectStack↑[BisectPtr-15]+BisectStack↑
[BisectPtr-14]+BisectStack↑[BisectPtr-13];
IF BisectStack↑[BisectPtr-12]>0 THEN BisectStack↑[BisectPtr-12]←0;
END ELSE BEGIN BisectStack↑[BisectPtr-11]←
BisectStack↑[BisectPtr-15]+BisectStack↑[BisectPtr-14]+BisectStack↑[BisectPtr-13];
IF BisectStack↑[BisectPtr-11]<BisectStack↑[BisectPtr-15] THEN
BisectStack↑[BisectPtr-11]←BisectStack↑[BisectPtr-15];
BisectStack↑[BisectPtr-12]←BisectStack↑[BisectPtr-15]+BisectStack↑
[BisectPtr-14];
IF BisectStack↑[BisectPtr-12]>0 THEN BisectStack↑[BisectPtr-12]←0;
END;BisectStack↑[BisectPtr-20]←Mem[ INT[Pp]+6]↑.Int-Mem[ INT[Pp]+2]↑.Int;
BisectStack↑[BisectPtr-19]←Mem[ INT[Qq]+4]↑.Int-Mem[ INT[Pp]+6]↑.Int;
BisectStack↑[BisectPtr-18]←Mem[ INT[Qq]+2]↑.Int-Mem[ INT[Qq]+4]↑.Int;
IF BisectStack↑[BisectPtr-20]<0 THEN IF BisectStack↑[BisectPtr-18]>=0
THEN BEGIN IF BisectStack↑[BisectPtr-19]<0 THEN BisectStack↑[BisectPtr
-17]←BisectStack↑[BisectPtr-20]+BisectStack↑[BisectPtr-19] ELSE
BisectStack↑[BisectPtr-17]←BisectStack↑[BisectPtr-20];
BisectStack↑[BisectPtr-16]←BisectStack↑[BisectPtr-20]+BisectStack↑
[BisectPtr-19]+BisectStack↑[BisectPtr-18];
IF BisectStack↑[BisectPtr-16]<0 THEN BisectStack↑[BisectPtr-16]←0;
END ELSE BEGIN BisectStack↑[BisectPtr-17]←
BisectStack↑[BisectPtr-20]+BisectStack↑[BisectPtr-19]+BisectStack↑[BisectPtr-18];
IF BisectStack↑[BisectPtr-17]>BisectStack↑[BisectPtr-20] THEN
BisectStack↑[BisectPtr-17]←BisectStack↑[BisectPtr-20];
BisectStack↑[BisectPtr-16]←BisectStack↑[BisectPtr-20]+BisectStack↑
[BisectPtr-19];
IF BisectStack↑[BisectPtr-16]<0 THEN BisectStack↑[BisectPtr-16]←0;
END ELSE IF BisectStack↑[BisectPtr-18]<=0 THEN BEGIN IF BisectStack↑
[BisectPtr-19]>0 THEN BisectStack↑[BisectPtr-16]←BisectStack↑
[BisectPtr-20]+BisectStack↑[BisectPtr-19] ELSE BisectStack↑[BisectPtr
-16]←BisectStack↑[BisectPtr-20];
BisectStack↑[BisectPtr-17]←BisectStack↑[BisectPtr-20]+BisectStack↑
[BisectPtr-19]+BisectStack↑[BisectPtr-18];
IF BisectStack↑[BisectPtr-17]>0 THEN BisectStack↑[BisectPtr-17]←0;
END ELSE BEGIN BisectStack↑[BisectPtr-16]←
BisectStack↑[BisectPtr-20]+BisectStack↑[BisectPtr-19]+BisectStack↑[BisectPtr-18];
IF BisectStack↑[BisectPtr-16]<BisectStack↑[BisectPtr-20] THEN
BisectStack↑[BisectPtr-16]←BisectStack↑[BisectPtr-20];
BisectStack↑[BisectPtr-17]←BisectStack↑[BisectPtr-20]+BisectStack↑
[BisectPtr-19];
IF BisectStack↑[BisectPtr-17]>0 THEN BisectStack↑[BisectPtr-17]←0;
END;Delx←Mem[ INT[P]+1]↑.Int-Mem[ INT[Pp]+1]↑.Int;Dely←Mem[ INT[P]+2]↑.Int-Mem[ INT[Pp]+2]↑.Int;
Tol←0;Uv←BisectPtr;Xy←BisectPtr;ThreeL←0;CurT←1;CurTt←1 ; END;
--:558-- TimeToGo←5000;CIInit1[];CIInit2[];
{WHILE TRUE DO BEGIN DO {--Label22:--IF Delx-Tol<=BisectStack↑[Xy-11]-BisectStack↑[Uv
-2] THEN IF Delx+Tol>=BisectStack↑[Xy-12]-BisectStack↑[Uv-1] THEN IF
Dely-Tol<=BisectStack↑[Xy-16]-BisectStack↑[Uv-7] THEN IF
Dely+Tol>=BisectStack↑[Xy-17]-BisectStack↑[Uv-6] THEN BEGIN IF CurT>=131072 THEN
BEGIN CurT← PascalDIVPower2[(CurT+1),1];CurTt← PascalDIVPower2[(CurTt+1),1]; GOTO Label10; END;
InterSubdivide[]; GOTO Label22; END;
IF TimeToGo>0 THEN TimeToGo←TimeToGo-1 ELSE BEGIN CurT←0;
CurTt←0; GOTO Label10; END;--560:
DO {--Label45:--IF PascalODD[CurTt] THEN IF PascalODD[CurT] THEN--561:--BEGIN CurT← PascalDIVPower2[(CurT),1];
CurTt← PascalDIVPower2[(CurTt),1];IF CurT=0 THEN GOTO Label10;BisectPtr←BisectPtr-45;
Delx←BisectStack↑[BisectPtr];Dely←BisectStack↑[BisectPtr+1];
Tol←BisectStack↑[BisectPtr+2];Uv←BisectStack↑[BisectPtr+3];
Xy←BisectStack↑[BisectPtr+4]; GOTO Label45; END--:561
ELSE BEGIN CurT←CurT+1;
Delx←Delx+BisectStack↑[Uv-5]+BisectStack↑[Uv-4]+BisectStack↑[Uv-3];
Dely←Dely+BisectStack↑[Uv-10]+BisectStack↑[Uv-9]+BisectStack↑[Uv-8];
Uv←Uv+20;CurTt←CurTt-1;Xy←Xy-20;
Delx←Delx+BisectStack↑[Xy-15]+BisectStack↑[Xy-14]+BisectStack↑[Xy-13];
Dely←Dely+BisectStack↑[Xy-20]+BisectStack↑[Xy-19]+BisectStack↑[Xy-18];
END ELSE BEGIN CurTt←CurTt+1;Tol←Tol+ThreeL;
Delx←Delx-BisectStack↑[Xy-15]-BisectStack↑[Xy-14]-BisectStack↑[Xy-13];
Dely←Dely-BisectStack↑[Xy-20]-BisectStack↑[Xy-19]-BisectStack↑[Xy-18];
Xy←Xy+20; END--:560--;EXIT; EXITS Label45 => NULL} ENDLOOP;EXIT; EXITS Label22 => NULL} ENDLOOP; END ENDLOOP ;EXITS Label10 => NULL}; END;--:556----562:
END.