-- file: MFPathsImpl1.mesa -- Pascal-to-Mesa translator output, translated at October 31, 1985 4:28:01 pm PST DIRECTORY PascalBasic, PascalWizardFiles, MFTypes, MFProcArray, MFInteraction, MFMath, MFMemory, MFPaths; MFPathsImpl1: PROGRAM IMPORTS PascalBasic, MFProcArray, MFInteraction, MFMath, MFMemory EXPORTS MFPaths = PUBLIC BEGIN OPEN PascalBasic, PascalWizardFiles, MFTypes, MFProcArray, MFInteraction, MFMath, MFMemory, MFPaths; --:250----267:-- PathTail: Halfword; --:267----279: DeltaX: LONG POINTER TO ARRAY PascalInteger[0..300] OF Scaled ← PascalStaticZone.NEW[ARRAY PascalInteger[0..300] OF Scaled]; DeltaY: LONG POINTER TO ARRAY PascalInteger[0..300] OF Scaled ← PascalStaticZone.NEW[ARRAY PascalInteger[0..300] OF Scaled]; Delta: LONG POINTER TO ARRAY PascalInteger[0..300] OF Scaled ← PascalStaticZone.NEW[ARRAY PascalInteger[0..300] OF Scaled]; Psi: LONG POINTER TO ARRAY PascalInteger[1..300] OF Angle ← PascalStaticZone.NEW[ARRAY PascalInteger[1..300] OF Angle]; --:279----283: Theta: LONG POINTER TO ARRAY PascalInteger[0..300] OF Angle ← PascalStaticZone.NEW[ARRAY PascalInteger[0..300] OF Angle]; Uu: LONG POINTER TO ARRAY PascalInteger[0..300] OF Fraction ← PascalStaticZone.NEW[ARRAY PascalInteger[0..300] OF Fraction]; Vv: LONG POINTER TO ARRAY PascalInteger[0..300] OF Angle ← PascalStaticZone.NEW[ARRAY PascalInteger[0..300] OF Angle]; Ww: LONG POINTER TO ARRAY PascalInteger[0..300] OF Fraction ← PascalStaticZone.NEW[ARRAY PascalInteger[0..300] OF Fraction]; --:283 --298:-- St: Fraction; Ct: Fraction; Sf: Fraction; Cf: Fraction; PrintPath: PROCEDURE[H: Halfword,S: StrNumber,Nuline: PascalBoolean] = BEGIN P, Q:Halfword; PrintDiagnostic[385,S,Nuline]; PrintLn[];P←H;{DO Q←Mem[P]↑.Hh.Rh; IF(P=0)OR (Q=0) THEN BEGIN PrintNl[131]; GOTO Label30; END;--258: PrintTwo[Mem[ INT[P]+1]↑.Int,Mem[ INT[P]+2]↑.Int]; {SELECT Mem[P]↑.Hh.B1 FROM 0 =>BEGIN IF Mem[P]↑.Hh.B0=4 THEN Print[386]; IF(Mem[Q]↑.Hh.B0#0)OR (Q#H) THEN Q←0; GOTO Label31; END;1 =>--261: BEGIN Print[392];PrintTwo[Mem[ INT[P]+5]↑.Int,Mem[ INT[P]+6]↑.Int];Print[391]; IF Mem[Q]↑.Hh.B0#1 THEN Print[393] ELSE PrintTwo[Mem[ INT[Q]+3]↑.Int,Mem[ INT[Q]+4]↑. Int]; GOTO Label31; END--:261--;4 =>--262: IF(Mem[P]↑.Hh.B0#1)AND (Mem[P]↑.Hh.B0#4) THEN Print[386]--:262--;3,2 =>--263: BEGIN IF Mem[P]↑.Hh.B0=4 THEN Print[393]; IF Mem[P]↑.Hh.B1=3 THEN BEGIN Print[389];PrintScaled[Mem[ INT[P]+5]↑.Int]; END ELSE BEGIN NSinCos[Mem[ INT[P]+5]↑.Int];PrintChar[123]; PrintScaled[NCos];PrintChar[44];PrintScaled[NSin]; END; PrintChar[125]; END--:263--; ENDCASE =>Print[131]; IF INT[Mem[Q]↑.Hh.B0]<=1 THEN Print[387] ELSE IF(Mem[ INT[P]+6]↑.Int#65536)OR (Mem[ INT[Q]+4 ]↑.Int#65536) THEN--260:--BEGIN Print[390]; IF Mem[ INT[P]+6]↑.Int<0 THEN Print[333];PrintScaled[ABS[Mem[ INT[P]+6]↑.Int]]; IF Mem[ INT[P]+6]↑.Int#Mem[ INT[Q]+4]↑.Int THEN BEGIN Print[391]; IF Mem[ INT[Q]+4]↑.Int<0 THEN Print[333];PrintScaled[ABS[Mem[ INT[Q]+4]↑.Int]]; END; END--:260--;EXITS Label31 => NULL};--:258--P←Q;IF(P#H)OR (Mem[H]↑.Hh.B0#0) THEN--259: BEGIN PrintNl[388]; IF Mem[P]↑.Hh.B0=2 THEN BEGIN NSinCos[Mem[ INT[P]+3]↑.Int];PrintChar[123]; PrintScaled[NCos];PrintChar[44];PrintScaled[NSin];PrintChar[125]; END ELSE IF Mem[P]↑.Hh.B0=3 THEN BEGIN Print[389]; PrintScaled[Mem[ INT[P]+3]↑.Int];PrintChar[125]; END; END--:259--; IF P=H THEN EXIT; ENDLOOP; IF Mem[H]↑.Hh.B0#0 THEN Print[258];EXITS Label30 => NULL};EndDiagnostic[TRUE]; END;--:257 --:603----268:-- TossKnotList: PROCEDURE[P: Halfword] = BEGIN Q:Halfword; R:Halfword; Q←P;DO R←Mem[Q]↑.Hh.Rh;FreeNode[Q,7];Q←R; IF Q=P THEN EXIT; ENDLOOP; END;--:268----385:-- CopyKnot: PROCEDURE[P: Halfword] RETURNS[CopyKnotResult: Halfword] = BEGIN Q:Halfword;K:PascalInteger[0..6]; Q←GetNode[7]; FOR i:INT IN [ INT[0 ].. INT[6 ]] DO K ← i; Mem[ INT[Q]+K]↑←Mem[ INT[P]+K]↑ ENDLOOP;CopyKnotResult←Q; END;--:264----265: CopyPath: PROCEDURE[P: Halfword] RETURNS[CopyPathResult: Halfword] = BEGIN Q, Pp, Qq:Halfword; Q←GetNode[7];Qq←Q;Pp←P; {WHILE TRUE DO BEGIN Mem[Qq]↑.Hh.B0←Mem[Pp]↑.Hh.B0; Mem[Qq]↑.Hh.B1←Mem[Pp]↑.Hh.B1;Mem[ INT[Qq]+1]↑.Int←Mem[ INT[Pp]+1]↑.Int; Mem[ INT[Qq]+2]↑.Int←Mem[ INT[Pp]+2]↑.Int;Mem[ INT[Qq]+3]↑.Int←Mem[ INT[Pp]+3]↑.Int; Mem[ INT[Qq]+4]↑.Int←Mem[ INT[Pp]+4]↑.Int;Mem[ INT[Qq]+5]↑.Int←Mem[ INT[Pp]+5]↑.Int; Mem[ INT[Qq]+6]↑.Int←Mem[ INT[Pp]+6]↑.Int; IF Mem[Pp]↑.Hh.Rh=P THEN BEGIN Mem[Qq]↑.Hh.Rh←Q;CopyPathResult←Q; GOTO Label10; END; Mem[Qq]↑.Hh.Rh←GetNode[7];Qq←Mem[Qq]↑.Hh.Rh;Pp←Mem[Pp]↑.Hh.Rh; END ENDLOOP ; EXITS Label10 => NULL}; END;--:265----266:-- HtapYpoc: PROCEDURE[P: Halfword] RETURNS[HtapYpocResult: Halfword] = BEGIN Q, Pp, Qq, Rr:Halfword; Q←GetNode[7];Qq←Q;Pp←P; {WHILE TRUE DO BEGIN Mem[Qq]↑.Hh.B1←Mem[Pp]↑.Hh.B0; Mem[Qq]↑.Hh.B0←Mem[Pp]↑.Hh.B1;Mem[ INT[Qq]+1]↑.Int←Mem[ INT[Pp]+1]↑.Int; Mem[ INT[Qq]+2]↑.Int←Mem[ INT[Pp]+2]↑.Int;Mem[ INT[Qq]+5]↑.Int←Mem[ INT[Pp]+3]↑.Int; Mem[ INT[Qq]+6]↑.Int←Mem[ INT[Pp]+4]↑.Int;Mem[ INT[Qq]+3]↑.Int←Mem[ INT[Pp]+5]↑.Int; Mem[ INT[Qq]+4]↑.Int←Mem[ INT[Pp]+6]↑.Int; IF Mem[Pp]↑.Hh.Rh=P THEN BEGIN Mem[Q]↑.Hh.Rh←Qq;PathTail←Pp; HtapYpocResult←Q; GOTO Label10; END;Rr←GetNode[7];Mem[Rr]↑.Hh.Rh←Qq;Qq←Rr; Pp←Mem[Pp]↑.Hh.Rh; END ENDLOOP ;EXITS Label10 => NULL}; END;--:266----269:----284:----296: CurlRatio: PROCEDURE[Gamma,ATension,BTension: Scaled] RETURNS[CurlRatioResult: Fraction] = BEGIN Alpha, Beta, Num, Denom, Ff:Fraction; Alpha←MakeFraction[65536,ATension]; Beta←MakeFraction[65536,BTension]; IF Alpha<=Beta THEN BEGIN Ff←MakeFraction[Alpha,Beta]; Ff←TakeFraction[Ff,Ff];Gamma←TakeFraction[Gamma,Ff]; Beta← PascalDIVPower2[Beta ,12];Denom←TakeFraction[Gamma,Alpha]+196608-Beta; Num←TakeFraction[Gamma,805306368-Alpha]+Beta; END ELSE BEGIN Ff←MakeFraction[Beta,Alpha];Ff←TakeFraction[Ff,Ff]; Beta← PascalDIVPower2[TakeFraction[Beta,Ff],12]; Denom←TakeFraction[Gamma,Alpha]+( Ff /1365)-Beta; Num←TakeFraction[Gamma,805306368-Alpha]+Beta; END; IF Num>=Denom+Denom+Denom+Denom THEN CurlRatioResult←1073741824 ELSE CurlRatioResult←MakeFraction[Num,Denom]; END;--:296----299: SetControls: PROCEDURE[P,Q: Halfword,K: PascalInteger] = BEGIN Rr, Ss:Fraction; Lt, Rt:Scaled;Sine:Fraction; Lt←ABS[Mem[ INT[Q]+4]↑.Int]; Rt←ABS[Mem[ INT[P]+6]↑.Int];Rr←Velocity[St,Ct,Sf,Cf,Rt]; Ss←Velocity[Sf,Cf,St,Ct,Lt]; IF(Mem[ INT[P]+6]↑.Int<0)OR (Mem[ INT[Q]+4]↑.Int<0) THEN--300: IF((St>=0)AND (Sf>=0))OR ((St<=0)AND (Sf<=0)) THEN BEGIN Sine←TakeFraction [ABS[St],Cf]+TakeFraction[ABS[Sf],Ct]; IF Sine>0 THEN BEGIN Sine←TakeFraction[Sine,268500992]; IF Mem[ INT[P]+6]↑.Int<0 THEN IF AbVsCd[ABS[Sf],268435456,Rr,Sine]<0 THEN Rr ←MakeFraction[ABS[Sf],Sine]; IF Mem[ INT[Q]+4]↑.Int<0 THEN IF AbVsCd[ABS[St],268435456,Ss,Sine]<0 THEN Ss ←MakeFraction[ABS[St],Sine]; END; END--:300--; Mem[ INT[P]+5]↑.Int←Mem[ INT[P]+1]↑.Int+TakeFraction[ TakeFraction[DeltaX↑[K],Ct]-TakeFraction[DeltaY↑[K],St],Rr]; Mem[ INT[P]+6]↑.Int←Mem[ INT[P]+2]↑.Int+TakeFraction[ TakeFraction[DeltaY↑[K],Ct]+TakeFraction[DeltaX↑[K],St],Rr]; Mem[ INT[Q]+3]↑.Int←Mem[ INT[Q]+1]↑.Int-TakeFraction[ TakeFraction[DeltaX↑[K],Cf]+TakeFraction[DeltaY↑[K],Sf],Ss]; Mem[ INT[Q]+4]↑.Int←Mem[ INT[Q]+2]↑.Int-TakeFraction[ TakeFraction[DeltaY↑[K],Cf]-TakeFraction[DeltaX↑[K],Sf],Ss];Mem[P]↑.Hh.B1←1;Mem[Q]↑.Hh.B0←1; END; END.