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


DIRECTORY
  PascalBasic,
  PascalWizardFiles,
  MFTypes,
  MFProcArray,
  MFInteraction,
  MFMemory,
  MFPaths,
  MFOctants,
  MFInput,
  MFParsing,
  MFOps;

MFParsingImpl3: PROGRAM IMPORTS MFProcArray, MFInteraction, MFMemory, MFPaths, MFOctants, MFInput, MFParsing, MFOps EXPORTS MFParsing = PUBLIC
BEGIN OPEN PascalBasic, PascalWizardFiles, MFTypes, MFProcArray, MFInteraction, MFMemory, MFPaths, MFOctants, MFInput, MFParsing, MFOps;
  ScanSecondary: PROCEDURE = 
BEGIN 
 P:Halfword;C, D:Halfword;MacName:Halfword;
 DO {--Label20:--IF( INT[CurCmd]<30)OR ( INT[CurCmd]>43) THEN BadExp[669];ScanPrimary[];
DO {--Label22:--IF  INT[CurCmd]<=55  THEN IF  INT[CurCmd]>=52  THEN BEGIN P←StashCurExp[];
C←CurMod;D←CurCmd;IF D=53  THEN BEGIN MacName←CurSym;
Mem[C]↑.Hh.Lh← INT[Mem[C]↑.Hh.Lh]+1; END;GetXNext[];ScanPrimary[];
IF D#53  THEN DoBinary[P,C] ELSE BEGIN BackInput[];
BinaryMac[P,C,MacName];Mem[C]↑.Hh.Lh← INT[Mem[C]↑.Hh.Lh]-1;GetXNext[];
 GOTO Label20; END; GOTO Label22; END;EXIT; EXITS Label22 => NULL} ENDLOOP;EXIT; EXITS Label20 => NULL} ENDLOOP; END;--:861----863:-- 
 ScanTertiary: PROCEDURE
 = 
BEGIN  P:Halfword;C, D:Halfword;MacName:Halfword;
 DO {--Label20:--IF( INT[CurCmd]<30)OR ( INT[CurCmd]>43) THEN BadExp[670];ScanSecondary[];
IF CurType=8  THEN MaterializePen[];
DO {--Label22:--IF  INT[CurCmd]<=45  THEN IF  INT[CurCmd]>=43  THEN BEGIN P←StashCurExp[];
C←CurMod;D←CurCmd;IF D=44  THEN BEGIN MacName←CurSym;
Mem[C]↑.Hh.Lh← INT[Mem[C]↑.Hh.Lh]+1; END;GetXNext[];ScanSecondary[];
IF D#44  THEN DoBinary[P,C] ELSE BEGIN BackInput[];
BinaryMac[P,C,MacName];Mem[C]↑.Hh.Lh← INT[Mem[C]↑.Hh.Lh]-1;GetXNext[];
 GOTO Label20; END; GOTO Label22; END;EXIT; EXITS Label22 => NULL} ENDLOOP;EXIT; EXITS Label20 => NULL} ENDLOOP; END;--:863----867:-- 
 ScanExpression: PROCEDURE = 
BEGIN  P, Q, R, Pp, Qq:Halfword;C, D:Halfword;
MyVarFlag:PascalInteger[0..82];MacName:Halfword;CycleHit:PascalBoolean;X, Y:Scaled;T:PascalInteger[0..4];
 MyVarFlag←VarFlag;
DO {--Label20:--IF( INT[CurCmd]<30)OR ( INT[CurCmd]>43) THEN BadExp[673];ScanTertiary[];
DO {--Label22:--{IF  INT[CurCmd]<=51  THEN IF  INT[CurCmd]>=46  THEN IF(CurCmd#51)OR (MyVarFlag
#77) THEN BEGIN P←StashCurExp[];C←CurMod;D←CurCmd;
IF D=49  THEN BEGIN MacName←CurSym;Mem[C]↑.Hh.Lh← INT[Mem[C]↑.Hh.Lh]+1; END;
IF( INT[D]<48)OR ((D=48)AND ((Mem[P]↑.Hh.B0=14)OR (Mem[P]↑.Hh.B0=9))) THEN--868:
BEGIN CycleHit←FALSE;--869:--BEGIN UnstashCurExp[P];
IF CurType=14  THEN P←NewKnot [] ELSE IF CurType=9  THEN P←CurExp  ELSE
 GOTO Label10;Q←P;WHILE Mem[Q]↑.Hh.Rh#P DO Q←Mem[Q]↑.Hh.Rh ENDLOOP ;
IF Mem[P]↑.Hh.B0#0  THEN BEGIN R←CopyKnot[P];Mem[Q]↑.Hh.Rh←R;Q←R; END;
Mem[P]↑.Hh.B0←4;Mem[Q]↑.Hh.B1←4; END--:869--;DO {--Label25:----873:
IF CurCmd=46  THEN--878:--BEGIN T←ScanDirection[];
IF T#4  THEN BEGIN Mem[Q]↑.Hh.B1←T;Mem[ INT[Q]+5]↑.Int←CurExp;
IF Mem[Q]↑.Hh.B0=4  THEN BEGIN Mem[Q]↑.Hh.B0←T;Mem[ INT[Q]+3]↑.Int←CurExp; END;
 END; END--:878--;D←CurCmd;{IF D=47  THEN--880:--BEGIN GetXNext[];
{IF CurCmd=58  THEN--881:--BEGIN GetXNext[];Y←CurCmd;
IF CurCmd=59  THEN GetXNext[];ScanPrimary[];--882:
IF(CurType#16)OR (CurExp<49152) THEN BEGIN DispErr[0,691];
BEGIN HelpPtr←1;HelpLine↑[0]←692; END;PutGetFlushError[65536];
 END--:882--;IF Y=59  THEN CurExp←-CurExp;Mem[ INT[Q]+6]↑.Int←CurExp;
IF CurCmd=52  THEN BEGIN GetXNext[];Y←CurCmd;
IF CurCmd=59  THEN GetXNext[];ScanPrimary[];--882:
IF(CurType#16)OR (CurExp<49152) THEN BEGIN DispErr[0,691];
BEGIN HelpPtr←1;HelpLine↑[0]←692; END;PutGetFlushError[65536];
 END--:882--;IF Y=59  THEN CurExp←-CurExp; END;Y←CurExp; END--:881
 ELSE IF CurCmd=57  THEN--883:--BEGIN Mem[Q]↑.Hh.B1←1;T←1;GetXNext[];
ScanPrimary[];KnownPair[];Mem[ INT[Q]+5]↑.Int←CurX;Mem[ INT[Q]+6]↑.Int←CurY;
IF CurCmd#52  THEN BEGIN X←Mem[ INT[Q]+5]↑.Int;Y←Mem[ INT[Q]+6]↑.Int;
 END  ELSE BEGIN GetXNext[];ScanPrimary[];KnownPair[];X←CurX;Y←CurY; END;
 END--:883-- ELSE BEGIN Mem[ INT[Q]+6]↑.Int←65536;Y←65536;BackInput[]; GOTO Label30; END;
IF CurCmd#47  THEN BEGIN MissingErr[281];BEGIN HelpPtr←1;
HelpLine↑[0]←690; END;BackError[]; END;EXITS Label30 => NULL}; END--:880
 ELSE IF D#48  THEN  GOTO Label26;GetXNext[];IF CurCmd=46  THEN--879:
BEGIN T←ScanDirection[];IF Mem[Q]↑.Hh.B1#1  THEN X←CurExp  ELSE T←1;
 END--:879-- ELSE IF Mem[Q]↑.Hh.B1#1  THEN BEGIN T←4;X←0; END--:873--;
IF CurCmd=36  THEN--885:--BEGIN CycleHit←TRUE;GetXNext[];Pp←P;Qq←P;
IF D=48  THEN IF P=Q  THEN BEGIN D←47;Mem[ INT[Q]+6]↑.Int←65536;Y←65536; END;
 END--:885-- ELSE BEGIN ScanTertiary[];--884:
BEGIN IF CurType#9  THEN Pp←NewKnot [] ELSE Pp←CurExp;Qq←Pp;
WHILE Mem[Qq]↑.Hh.Rh#Pp DO Qq←Mem[Qq]↑.Hh.Rh ENDLOOP ;
IF Mem[Pp]↑.Hh.B0#0  THEN BEGIN R←CopyKnot[Pp];Mem[Qq]↑.Hh.Rh←R;Qq←R;
 END;Mem[Pp]↑.Hh.B0←4;Mem[Qq]↑.Hh.B1←4; END--:884--; END;--886:
BEGIN IF D=48  THEN IF(Mem[ INT[Q]+1]↑.Int#Mem[ INT[Pp]+1]↑.Int)OR (Mem[ INT[Q]+2]↑.Int#Mem[
 INT[Pp]+2]↑.Int) THEN BEGIN BEGIN IF Interaction=3  THEN NULL;PrintNl[133];
Print[693]; END;BEGIN HelpPtr←3;HelpLine↑[2]←694;HelpLine↑[1]←695;
HelpLine↑[0]←696; END;PutGetError[];D←47;Mem[ INT[Q]+6]↑.Int←65536;Y←65536;
 END;--888:
IF Mem[Pp]↑.Hh.B1=4  THEN IF(T=3)OR (T=2) THEN BEGIN Mem[Pp]↑.Hh.B1←T;
Mem[ INT[Pp]+5]↑.Int←X; END--:888--;IF D=48  THEN--889:
BEGIN IF Mem[Q]↑.Hh.B0=4  THEN IF Mem[Q]↑.Hh.B1=4  THEN BEGIN Mem[Q]↑.Hh.B0←
3;Mem[ INT[Q]+3]↑.Int←65536; END;
IF Mem[Pp]↑.Hh.B1=4  THEN IF T=4  THEN BEGIN Mem[Pp]↑.Hh.B1←3;
Mem[ INT[Pp]+5]↑.Int←65536; END;Mem[Q]↑.Hh.B1←Mem[Pp]↑.Hh.B1;
Mem[Q]↑.Hh.Rh←Mem[Pp]↑.Hh.Rh;Mem[ INT[Q]+5]↑.Int←Mem[ INT[Pp]+5]↑.Int;
Mem[ INT[Q]+6]↑.Int←Mem[ INT[Pp]+6]↑.Int;FreeNode[Pp,7];IF Qq=Pp  THEN Qq←Q;
 END--:889-- ELSE BEGIN--887:
IF Mem[Q]↑.Hh.B1=4  THEN IF(Mem[Q]↑.Hh.B0=3)OR (Mem[Q]↑.Hh.B0=2) THEN BEGIN
Mem[Q]↑.Hh.B1←Mem[Q]↑.Hh.B0;Mem[ INT[Q]+5]↑.Int←Mem[ INT[Q]+3]↑.Int; END--:887--;
Mem[Q]↑.Hh.Rh←Pp;Mem[ INT[Pp]+4]↑.Int←Y;IF T#4  THEN BEGIN Mem[ INT[Pp]+3]↑.Int←X;
Mem[Pp]↑.Hh.B0←T; END; END;Q←Qq; END--:886--;
IF  INT[CurCmd]>=46  THEN IF  INT[CurCmd]<=48  THEN IF  NOT CycleHit  THEN  GOTO Label25;
EXITS Label26 => NULL};--890:--IF CycleHit  THEN BEGIN IF D=48  THEN P←Q;
 END  ELSE BEGIN Mem[P]↑.Hh.B0←0;
IF Mem[P]↑.Hh.B1=4  THEN BEGIN Mem[P]↑.Hh.B1←3;Mem[ INT[P]+5]↑.Int←65536; END;
Mem[Q]↑.Hh.B1←0;IF Mem[Q]↑.Hh.B0=4  THEN BEGIN Mem[Q]↑.Hh.B0←3;
Mem[ INT[Q]+3]↑.Int←65536; END;Mem[Q]↑.Hh.Rh←P; END;MakeChoices[P];CurType←9;
CurExp←P--:890--;EXIT; EXITS Label25 => NULL} ENDLOOP; END--:868-- ELSE BEGIN GetXNext[];ScanTertiary[];
IF D#49  THEN DoBinary[P,C] ELSE BEGIN BackInput[];
BinaryMac[P,C,MacName];Mem[C]↑.Hh.Lh← INT[Mem[C]↑.Hh.Lh]-1;GetXNext[];
 GOTO Label20; END; END; GOTO Label22; END;EXITS Label10 => NULL};EXIT; EXITS Label22 => NULL} ENDLOOP;EXIT; EXITS Label20 => NULL} ENDLOOP; END;--:867----891:-- 
 GetBoolean: PROCEDURE = 
BEGIN GetXNext[];ScanExpression[];
IF CurType#2  THEN BEGIN DispErr[0,697];BEGIN HelpPtr←2;
HelpLine↑[1]←698;HelpLine↑[0]←699; END;PutGetFlushError[31];
CurType←2; END; END;--:891----224:--
END.