-- file: MFTimeImpl1.mesa -- Pascal-to-Mesa translator output, translated at October 31, 1985 4:28:02 pm PST DIRECTORY PascalBasic, PascalWizardFiles, MFTypes, MFProcArray, MFMath, MFOctants, MFTime; MFTimeImpl1: PROGRAM IMPORTS PascalBasic, MFProcArray, MFMath, MFOctants, MFTime EXPORTS MFTime = PUBLIC BEGIN OPEN PascalBasic, PascalWizardFiles, MFTypes, MFProcArray, MFMath, MFOctants, MFTime; --:507----552: TolStep: PascalInteger[0..6]; --:552----555:-- CurT: PascalInteger; CurTt: PascalInteger; TimeToGo: PascalInteger; --:555 --557:-- Delx: PascalInteger; Dely: PascalInteger; Tol: PascalInteger; Uv: PascalInteger[0..BistackSize]; Xy: PascalInteger[0..BistackSize]; ThreeL: PascalInteger; --:527----539:-- FindDirectionTime: PROCEDURE[X,Y: Scaled,H: Halfword] RETURNS[FindDirectionTimeResult: Scaled] = BEGIN Max:Scaled;P, Q:Halfword;N:Scaled;Tt:Scaled;--542: X1, X2, X3, Y1, Y2, Y3:Scaled;Theta, Phi:Angle;T:Fraction;--:542----540: {IF ABS[X]<ABS[Y] THEN BEGIN X←MakeFraction[X,ABS[Y]]; IF Y>0 THEN Y←268435456 ELSE Y←-268435456; END ELSE IF X=0 THEN BEGIN FindDirectionTimeResult←0; GOTO Label10; END ELSE BEGIN Y←MakeFraction[Y,ABS[X]]; IF X>0 THEN X←268435456 ELSE X←-268435456; END--:540--;N←0;P←H; {{WHILE TRUE DO BEGIN IF Mem[P]↑.Hh.B1=0 THEN GOTO Label45;Q←Mem[P]↑.Hh.Rh; --541:--Tt←0;--543:--X1←Mem[ INT[P]+5]↑.Int-Mem[ INT[P]+1]↑.Int; X2←Mem[ INT[Q]+3]↑.Int-Mem[ INT[P]+5]↑.Int;X3←Mem[ INT[Q]+1]↑.Int-Mem[ INT[Q]+3]↑.Int; Y1←Mem[ INT[P]+6]↑.Int-Mem[ INT[P]+2]↑.Int;Y2←Mem[ INT[Q]+4]↑.Int-Mem[ INT[P]+6]↑.Int; Y3←Mem[ INT[Q]+2]↑.Int-Mem[ INT[Q]+4]↑.Int;Max←ABS[X1]; IF ABS[X2]>Max THEN Max←ABS[X2];IF ABS[X3]>Max THEN Max←ABS[X3]; IF ABS[Y1]>Max THEN Max←ABS[Y1];IF ABS[Y2]>Max THEN Max←ABS[Y2]; IF ABS[Y3]>Max THEN Max←ABS[Y3];IF Max=0 THEN GOTO Label40; WHILE Max<134217728 DO BEGIN Max←Max+Max;X1←X1+X1;X2←X2+X2;X3←X3+X3; Y1←Y1+Y1;Y2←Y2+Y2;Y3←Y3+Y3; END ENDLOOP ;T←X1; X1←TakeFraction[X1,X]+TakeFraction[Y1,Y]; Y1←TakeFraction[Y1,X]-TakeFraction[T,Y];T←X2; X2←TakeFraction[X2,X]+TakeFraction[Y2,Y]; Y2←TakeFraction[Y2,X]-TakeFraction[T,Y];T←X3; X3←TakeFraction[X3,X]+TakeFraction[Y3,Y]; Y3←TakeFraction[Y3,X]-TakeFraction[T,Y]--:543--; IF Y1=0 THEN IF X1>=0 THEN GOTO Label40;IF N>0 THEN BEGIN--544: Theta←NArg[X1,Y1]; IF Theta>=0 THEN IF Phi<=0 THEN IF Phi>=Theta-188743680 THEN GOTO Label40; IF Theta<=0 THEN IF Phi>=0 THEN IF Phi<=Theta+188743680 THEN GOTO Label40--: -- 544--;IF P=H THEN GOTO Label45; END;IF(X3#0)OR (Y3#0) THEN Phi←NArg[X3,Y3]; --546:--{IF X1<0 THEN IF X2<0 THEN IF X3<0 THEN GOTO Label30; IF AbVsCd[Y1,Y3,Y2,Y2]=0 THEN--548: BEGIN IF AbVsCd[Y1,Y2,0,0]<0 THEN BEGIN T←MakeFraction[Y1,Y1-Y2]; X1←X1-TakeFraction[X1-X2,T];X2←X2-TakeFraction[X2-X3,T]; IF X1-TakeFraction[X1-X2,T]>=0 THEN BEGIN Tt← PascalDIVPower2[(T+2048),12]; GOTO Label40; END; END ELSE IF Y3=0 THEN IF Y1=0 THEN--549: BEGIN T←CrossingPoint[-X1,-X2,-X3]; IF T<=268435456 THEN BEGIN Tt← PascalDIVPower2[(T+2048),12]; GOTO Label40; END; IF AbVsCd[X1,X3,X2,X2]<=0 THEN BEGIN T←MakeFraction[X1,X1-X2]; BEGIN Tt← PascalDIVPower2[(T+2048),12]; GOTO Label40; END; END; END--:549 ELSE IF X3>=0 THEN BEGIN Tt←65536; GOTO Label40; END; GOTO Label30; END--:548--; IF Y1<=0 THEN IF Y1<0 THEN BEGIN Y1←-Y1;Y2←-Y2;Y3←-Y3; END ELSE IF Y2>0 THEN BEGIN Y2←-Y2;Y3←-Y3; END;--547: T←CrossingPoint[Y1,Y2,Y3];IF T>268435456 THEN GOTO Label30; Y2←Y2-TakeFraction[Y2-Y3,T];X1←X1-TakeFraction[X1-X2,T]; X2←X2-TakeFraction[X2-X3,T];X1←X1-TakeFraction[X1-X2,T]; IF X1>=0 THEN BEGIN Tt← PascalDIVPower2[(T+2048),12]; GOTO Label40; END;IF Y2>0 THEN Y2←0; Tt←T;T←CrossingPoint[0,-Y2,-Y3];IF T>268435456 THEN GOTO Label30; X1←X1-TakeFraction[X1-X2,T];X2←X2-TakeFraction[X2-X3,T]; IF X1-TakeFraction[X1-X2,T]>=0 THEN BEGIN T←Tt-TakeFraction[Tt -268435456,T];BEGIN Tt← PascalDIVPower2[(T+2048),12]; GOTO Label40; END; END--:547--;EXITS Label30 => NULL};--:546 --:541--P←Q;N←N+65536; END ENDLOOP ;EXITS Label45 => NULL};FindDirectionTimeResult←-65536; GOTO Label10; EXITS Label40 => NULL};FindDirectionTimeResult←N+Tt;EXITS Label10 => NULL}; END;--:539----556: PathIntersection: PROCEDURE[H,Hh: Halfword] = BEGIN P, Pp:Halfword; N, Nn:PascalInteger;--563: IF Mem[H]↑.Hh.B1=0 THEN BEGIN Mem[ INT[H]+5]↑.Int←Mem[ INT[H]+1]↑.Int; Mem[ INT[H]+3]↑.Int←Mem[ INT[H]+1]↑.Int;Mem[ INT[H]+6]↑.Int←Mem[ INT[H]+2]↑.Int; Mem[ INT[H]+4]↑.Int←Mem[ INT[H]+2]↑.Int;Mem[H]↑.Hh.B1←1; END; IF Mem[Hh]↑.Hh.B1=0 THEN BEGIN Mem[ INT[Hh]+5]↑.Int←Mem[ INT[Hh]+1]↑.Int; Mem[ INT[Hh]+3]↑.Int←Mem[ INT[Hh]+1]↑.Int;Mem[ INT[Hh]+6]↑.Int←Mem[ INT[Hh]+2]↑.Int; Mem[ INT[Hh]+4]↑.Int←Mem[ INT[Hh]+2]↑.Int;Mem[Hh]↑.Hh.B1←1; END;--:563--TolStep←0; {DO N←-65536;P←H;DO IF Mem[P]↑.Hh.B1#0 THEN BEGIN Nn←-65536; Pp←Hh;DO IF Mem[Pp]↑.Hh.B1#0 THEN BEGIN CubicIntersection[P,Pp]; IF CurT>0 THEN BEGIN CurT←CurT+N;CurTt←CurTt+Nn; GOTO Label10; END; END; Nn←Nn+65536;Pp←Mem[Pp]↑.Hh.Rh; IF Pp=Hh THEN EXIT; ENDLOOP; END;N←N+65536; P←Mem[P]↑.Hh.Rh; IF P=H THEN EXIT; ENDLOOP;TolStep←TolStep+3; IF INT[TolStep]>3 THEN EXIT; ENDLOOP; CurT←-65536;CurTt←-65536;EXITS Label10 => NULL}; END;--:562----564: END.