-- file: MFContoursImpl.mesa
-- Pascal-to-Mesa translator output, translated at October 31, 1985 4:28:01 pm PST


DIRECTORY
  PascalBasic,
  PascalWizardFiles,
  MFTypes,
  MFProcArray,
  MFInteraction,
  MFSymbols,
  MFPaths,
  MFMoves,
  MFEdges,
  MFEnvelopes,
  MFOctants,
  MFContours;

MFContoursImpl: PROGRAM IMPORTS PascalBasic, MFProcArray, MFInteraction, MFSymbols, MFPaths, MFMoves, MFEdges, MFEnvelopes, MFOctants EXPORTS MFContours = PUBLIC
BEGIN OPEN PascalBasic, PascalWizardFiles, MFTypes, MFProcArray, MFInteraction, MFSymbols, MFPaths, MFMoves, MFEdges, MFEnvelopes, MFOctants, MFContours;
--:371----379:--
Octant: PascalInteger[1..8];
--:455
--461:--YCorr: LONG POINTER TO ARRAY PascalInteger[1..8] OF PascalInteger[0..1] ← PascalStaticZone.NEW[ARRAY PascalInteger[1..8] OF PascalInteger[0..1]];
XyCorr: LONG POINTER TO ARRAY PascalInteger[1..8] OF PascalInteger[0..1] ← PascalStaticZone.NEW[ARRAY PascalInteger[1..8] OF PascalInteger[0..1]];
ZCorr: LONG POINTER TO ARRAY PascalInteger[1..8] OF PascalInteger[0..1] ← PascalStaticZone.NEW[ARRAY PascalInteger[1..8] OF PascalInteger[0..1]];

XCorr: LONG POINTER TO ARRAY PascalInteger[1..8] OF PascalInteger[-1..1] ← PascalStaticZone.NEW[ARRAY PascalInteger[1..8] OF PascalInteger[-1..1]];
--:461----464:--
M0: PascalInteger;

N0: PascalInteger;

M1: PascalInteger;

N1: PascalInteger;

D0: PascalInteger[0..1];

D1: PascalInteger[0..1];
 Skew: PROCEDURE[X,Y: Scaled,
Octant: SmallNumber] = 
BEGIN SELECT Octant FROM 1 =>BEGIN CurX←X-Y;CurY←Y;
 END;5 =>BEGIN CurX←Y-X;CurY←X; END;6 =>BEGIN CurX←Y+X;CurY←-X; END;
2 =>BEGIN CurX←-X-Y;CurY←Y; END;4 =>BEGIN CurX←-X+Y;CurY←-Y; END;
8 =>BEGIN CurX←-Y+X;CurY←-X; END;7 =>BEGIN CurX←-Y-X;CurY←X; END;
3 =>BEGIN CurX←X+Y;CurY←-Y; END; ENDCASE; END;--:387----390:
--465:-- FillSpec: PROCEDURE[H: Halfword] = 
BEGIN P, Q, R, S:Halfword;
 IF Internal↑[10]>0  THEN BeginEdgeTracing[];P←H;
DO Octant←Mem[ INT[P]+3]↑.Int;--466:--Q←P;
WHILE Mem[Q]↑.Hh.B1#0 DO Q←Mem[Q]↑.Hh.Rh--:466-- ENDLOOP ;IF Q#P  THEN BEGIN--467:
EndRound[Mem[ INT[P]+1]↑.Int,Mem[ INT[P]+2]↑.Int];M0←M1;N0←N1;D0←D1;
EndRound[Mem[ INT[Q]+1]↑.Int,Mem[ INT[Q]+2]↑.Int]--:467--;--468:
IF N1-N0>=MoveSize  THEN Overflow[408,MoveSize];Move↑[0]←D0;
MovePtr←0;R←P;DO S←Mem[R]↑.Hh.Rh;
MakeMoves[Mem[ INT[R]+1]↑.Int,Mem[ INT[R]+5]↑.Int,Mem[ INT[S]+3]↑.Int,Mem[ INT[S]+1]↑.Int,Mem[ INT[R]+2]↑.
Int+32768,Mem[ INT[R]+6]↑.Int+32768,Mem[ INT[S]+4]↑.Int+32768,Mem[ INT[S]+2]↑.Int+32768,
XyCorr↑[Octant],YCorr↑[Octant]];R←S; IF R=Q THEN EXIT; ENDLOOP;
Move↑[MovePtr]←Move↑[MovePtr]-D1;
IF Internal↑[35]>0  THEN SmoothMoves[0,MovePtr]--:468--;
MoveToEdges[M0,N0,M1,N1]; END;P←Mem[Q]↑.Hh.Rh; IF P=H THEN EXIT; ENDLOOP;
TossKnotList[H];IF Internal↑[10]>0  THEN EndEdgeTracing[]; END;--:465

END.