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


DIRECTORY
  PascalBasic,
  PascalWizardFiles,
  MFTypes,
  MFProcArray,
  MFExternals,
  MFInteraction,
  MFMemory,
  MFSymbols,
  MFInput,
  MFParsing;

MFSymbolsImpl1: PROGRAM IMPORTS PascalBasic, MFProcArray, MFExternals, MFInteraction, MFMemory, MFInput, MFParsing EXPORTS MFSymbols = PUBLIC
BEGIN OPEN PascalBasic, PascalWizardFiles, MFTypes, MFProcArray, MFExternals, MFInteraction, MFMemory, MFSymbols, MFInput, MFParsing;
--:178
--190:--Internal: LONG POINTER TO ARRAY PascalInteger[1..100] OF Scaled ← PascalStaticZone.NEW[ARRAY PascalInteger[1..100] OF Scaled];

IntName: LONG POINTER TO ARRAY PascalInteger[1..100] OF StrNumber ← PascalStaticZone.NEW[ARRAY PascalInteger[1..100] OF StrNumber];

IntPtr: PascalInteger[40..MaxInternal];

--:190----196:--
OldSetting: PascalInteger[0..5];
--:196----198:
CharClass: LONG POINTER TO ARRAY AsciiCode OF PascalInteger[0..20] ← PascalStaticZone.NEW[ARRAY AsciiCode OF PascalInteger[0..20]];
--:198----200:--
HashUsed: Halfword;


StCount: PascalInteger;
--:200----201:--Hash: LONG POINTER TO ARRAY PascalInteger[1..2241] OF TwoHalves ← PascalStaticZone.NEW[ARRAY PascalInteger[1..2241] OF TwoHalves];

Eqtb: LONG POINTER TO ARRAY PascalInteger[1..2241] OF TwoHalves ← PascalStaticZone.NEW[ARRAY PascalInteger[1..2241] OF TwoHalves];
--:201----225:--
GPointer: Halfword;
--:225
--230:--BigNodeSize: LONG POINTER TO ARRAY PascalInteger[13..14] OF SmallNumber ← PascalStaticZone.NEW[ARRAY PascalInteger[13..14] OF SmallNumber];
--:230----250:

SavePtr: Halfword;
 ShowTokenList: PROCEDURE[P,Q: PascalInteger,L,NullTally: PascalInteger]
 = 
BEGIN  Class, C:SmallNumber;R, V:PascalInteger; Class←3;
Tally←NullTally;{WHILE(P#0)AND (Tally<L)DO BEGIN IF P=Q  THEN--645:
BEGIN FirstCount←Tally;
TrickCount←Tally+1+ErrorLine-HalfErrorLine;
IF TrickCount<ErrorLine  THEN TrickCount←ErrorLine; END--:645--;--218:
C←9;IF(P<0)OR (P>MemEnd) THEN BEGIN Print[361]; GOTO Label10; END;
IF P<HiMemMin  THEN--219:
IF Mem[P]↑.Hh.B1=12  THEN IF Mem[P]↑.Hh.B0=16  THEN--220:
BEGIN IF Class=0  THEN PrintChar[32];V←Mem[P+1]↑.Int;
IF V<0  THEN BEGIN IF Class=17  THEN PrintChar[32];PrintChar[91];
PrintScaled[V];PrintChar[93];C←18; END  ELSE BEGIN PrintScaled[V];
C←0; END; END--:220
 ELSE IF Mem[P]↑.Hh.B0#4  THEN Print[364] ELSE BEGIN PrintChar[34];
SlowPrint[Mem[P+1]↑.Int];PrintChar[34];C←4;
 END  ELSE IF(Mem[P]↑.Hh.B1#11)OR ( INT[Mem[P]↑.Hh.B0]<1)OR ( INT[Mem[P]↑.Hh.B0]>19) THEN
Print[364] ELSE BEGIN GPointer←P;PrintCapsule[];C←8; END--:219
 ELSE BEGIN R←Mem[P]↑.Hh.Lh;IF R>=2242  THEN--222:
BEGIN IF R<2392  THEN BEGIN Print[366];R←R-(2242);
 END  ELSE IF R<2542  THEN BEGIN Print[367];R←R-(2392);
 END  ELSE BEGIN Print[368];R←R-(2542); END;PrintInt[R];PrintChar[41];
C←8; END--:222-- ELSE IF R<1  THEN IF R=0  THEN--221:
BEGIN IF Class=17  THEN PrintChar[32];Print[365];C←18; END--:221
 ELSE Print[362] ELSE BEGIN R←Hash↑[R].Rh;
IF(R<0)OR (R>=StrPtr) THEN Print[363] ELSE--223:
BEGIN C←CharClass↑[StrPool↑[StrStart↑[R]]];
IF C=Class  THEN SELECT C FROM 9 =>PrintChar[46];5,6,7,8 => NULL;
 ENDCASE =>PrintChar[32];Print[R]; END--:223--; END; END--:218--;Class←C;
P←Mem[P]↑.Hh.Rh; END ENDLOOP ;IF P#0  THEN Print[360];EXITS Label10 => NULL}; END;--:217----664:
 Runaway: PROCEDURE = 
BEGIN IF  INT[ScannerStatus]>2  THEN BEGIN PrintNl[504];
SELECT ScannerStatus FROM 3 =>Print[505];4,5 =>Print[506];6 =>Print[507]; ENDCASE;
PrintLn[];ShowTokenList[Mem[49999]↑.Hh.Rh,0,ErrorLine-10,0]; END; END;
 PrintOp: PROCEDURE[C: Quarterword]
 = 
BEGIN IF  INT[C]<=15  THEN PrintType[C] ELSE SELECT C FROM 30 =>Print[220];
31 =>Print[221];32 =>Print[222];33 =>Print[223];34 =>Print[224];35 =>Print[225];
36 =>Print[226];37 =>Print[227];38 =>Print[228];39 =>Print[229];40 =>Print[230];
41 =>Print[231];42 =>Print[232];43 =>Print[233];44 =>Print[234];45 =>Print[235];
46 =>Print[236];47 =>Print[237];48 =>Print[238];49 =>Print[239];50 =>Print[240];
51 =>Print[241];52 =>Print[242];53 =>Print[243];54 =>Print[244];55 =>Print[245];
56 =>Print[246];57 =>Print[247];58 =>Print[248];59 =>Print[249];60 =>Print[250];
61 =>Print[251];62 =>Print[252];63 =>Print[253];64 =>Print[254];65 =>Print[255];
66 =>Print[256];67 =>Print[257];68 =>Print[258];69 =>PrintChar[43];
70 =>PrintChar[45];71 =>PrintChar[42];72 =>PrintChar[47];73 =>Print[259];
74 =>Print[183];75 =>Print[260];76 =>Print[261];77 =>PrintChar[60];
78 =>Print[262];79 =>PrintChar[62];80 =>Print[263];81 =>PrintChar[61];
82 =>Print[264];94 =>Print[265];95 =>Print[266];96 =>Print[267];97 =>Print[268];
98 =>Print[269];99 =>Print[270];100 =>Print[271];83 =>Print[38];84 =>Print[272];
85 =>Print[273];86 =>Print[274];87 =>Print[275];88 =>Print[276];89 =>Print[277];
90 =>Print[278];91 =>Print[279];92 =>Print[280]; ENDCASE =>Print[281]; END;
--:189----194:-- FixDateAndTime: PROCEDURE
 = 
BEGIN TheTime, TheDay, TheMonth, TheYear:PascalInteger;
 ReadTheClock[@TheTime,@TheDay,@TheMonth,@TheYear];
Internal↑[17]←TheTime*65536;Internal↑[16]←TheDay*65536;
Internal↑[15]←TheMonth*65536;Internal↑[14]←TheYear*65536; END;--:194
--205:-- IdLookup: PROCEDURE[J,L: PascalInteger] RETURNS[IdLookupResult: Halfword] = 
BEGIN  H:PascalInteger;
P:Halfword;K:Halfword; {IF L=1  THEN--206:--BEGIN P←Buffer↑[J]+1;
Hash↑[P].Rh← INT[P]-1; GOTO Label40; END--:206--;--208:--H←Buffer↑[J];
FOR i:INT    IN [ INT[J+1 ].. INT[J+L-1 ]] DO  K ← i;  H←H+H+Buffer↑[K];
WHILE H>=1777 DO H←H-1777 ENDLOOP ;--:208-- ENDLOOP;P←H+129;
WHILE TRUE DO BEGIN IF  INT[Hash↑[P].Rh]>0  THEN IF(
StrStart↑[ INT[Hash↑[P].Rh]+1]-StrStart↑[Hash↑[P].Rh])=L  THEN IF StrEqBuf[Hash↑[P].Rh,J] THEN  GOTO Label40;
IF Hash↑[P].Lh=0  THEN--207:
BEGIN IF  INT[Hash↑[P].Rh]>0  THEN BEGIN DO IF(HashUsed=1) THEN Overflow[328
,2100];HashUsed← INT[HashUsed]-1; IF Hash↑[HashUsed].Rh=0 THEN EXIT; ENDLOOP;
Hash↑[P].Lh←HashUsed;P←HashUsed; END;
BEGIN IF PoolPtr+L>MaxPoolPtr  THEN BEGIN IF PoolPtr+L>PoolSize  THEN
Overflow[129,PoolSize-InitPoolPtr];MaxPoolPtr←PoolPtr+L; END; END;
FOR i:INT    IN [ INT[J ].. INT[J+L-1 ]] DO  K ← i;  StrPool↑[PoolPtr]←Buffer↑[K];
PoolPtr←PoolPtr+1; ENDLOOP;Hash↑[P].Rh←MakeString[];
StrRef↑[Hash↑[P].Rh]←127;StCount←StCount+1; GOTO Label40; END--:207--;
P←Hash↑[P].Lh; END ENDLOOP ;EXITS Label40 => NULL};IdLookupResult←P; END;--:205----210:
 Primitive: PROCEDURE[S: StrNumber,C: Halfword,O: Halfword]
 = 
BEGIN K:PoolPointer;J:SmallNumber;L:SmallNumber; K←StrStart↑[S];
L←StrStart↑[S+1]-K;FOR i:INT    IN [ INT[0 ].. INT[L-1 ]] DO  J ← i; Buffer↑[J]←StrPool↑[K+J] ENDLOOP;
CurSym←IdLookup[0,L];IF  INT[S]>=128  THEN BEGIN FlushString[StrPtr-1];
Hash↑[CurSym].Rh←S; END;Eqtb↑[CurSym].Lh←C;Eqtb↑[CurSym].Rh←O; END;
--:210----215:-- NewNumTok: PROCEDURE[V: Scaled] RETURNS[NewNumTokResult: Halfword] = 
BEGIN P:Halfword;
 P←GetNode[2];Mem[ INT[P]+1]↑.Int←V;Mem[P]↑.Hh.B0←16;Mem[P]↑.Hh.B1←12;
NewNumTokResult←P; END;--:215----216:--
 FlushTokenList: PROCEDURE[P: Halfword] = 
BEGIN Q:Halfword;
 WHILE P#0 DO BEGIN Q←P;P←Mem[P]↑.Hh.Rh;
IF  INT[Q]>=HiMemMin  THEN BEGIN Mem[Q]↑.Hh.Rh←Avail;Avail←Q;
DynUsed←DynUsed-1; END  ELSE BEGIN SELECT Mem[Q]↑.Hh.B0 FROM 1,2,16 => NULL;
4 =>BEGIN IF  INT[StrRef↑[Mem[ INT[Q]+1]↑.Int]]<127  THEN IF  INT[StrRef↑[Mem[ INT[Q]+1]↑.Int]]>1
 THEN StrRef↑[Mem[ INT[Q]+1]↑.Int]←StrRef↑[Mem[ INT[Q]+1]↑.Int]-1  ELSE FlushString[
Mem[ INT[Q]+1]↑.Int]; END;
3,5,7,12,10,6,9,8,11,14,13,17,18,19 =>BEGIN GPointer←Q;TokenRecycle[];
 END; ENDCASE =>Confusion[359];FreeNode[Q,2]; END; END ENDLOOP ; END;--:216----226:
 DeleteMacRef: PROCEDURE[P: Halfword]
 = 
BEGIN IF Mem[P]↑.Hh.Lh=0  THEN FlushTokenList[P] ELSE Mem[P]↑.Hh.Lh← INT[Mem[P
]↑.Hh.Lh]-1; END;--:226----227:----624:-- PrintCmdMod: PROCEDURE[C,M: PascalInteger]
 = 
BEGIN SELECT C FROM--212:--18 =>Print[331];77 =>Print[330];59 =>Print[333];
72 =>Print[332];32 =>Print[334];78 =>Print[58];79 =>Print[44];57 =>Print[335];
19 =>Print[336];60 =>Print[337];27 =>Print[338];11 =>Print[339];81 =>Print[324];
26 =>Print[340];6 =>Print[341];9 =>Print[342];70 =>Print[343];73 =>Print[344];
13 =>Print[345];46 =>Print[123];63 =>Print[91];14 =>Print[346];15 =>Print[347];
69 =>Print[348];28 =>Print[349];47 =>Print[281];24 =>Print[350];
7 =>PrintChar[92];65 =>Print[125];64 =>Print[93];12 =>Print[351];8 =>Print[352];
80 =>Print[59];17 =>Print[353];74 =>Print[354];35 =>Print[355];58 =>Print[356];
71 =>Print[357];75 =>Print[358];--:212----683:
16 =>IF M<=2  THEN IF M=1  THEN Print[521] ELSE IF M<1  THEN Print[325] ELSE
Print[522] ELSE IF M=53  THEN Print[523] ELSE IF M=44  THEN Print[524] ELSE
Print[525];
4 =>IF M<=1  THEN IF M=1  THEN Print[528] ELSE Print[326] ELSE IF M=2242  THEN
Print[526] ELSE Print[527];--:683----688:--61 =>SELECT M FROM 1 =>Print[530];
2 =>PrintChar[64];3 =>Print[531]; ENDCASE =>Print[529];--:688----695:
56 =>IF M>=2242  THEN IF M=2242  THEN Print[542] ELSE IF M=2392  THEN Print[
543] ELSE Print[544] ELSE IF M<2  THEN Print[545] ELSE IF M=2  THEN Print[546
] ELSE Print[547];--:695----709:--3 =>IF M=0  THEN Print[557] ELSE Print[483];
--:709----740:--1,2 =>SELECT M FROM 1 =>Print[584];2 =>Print[323];3 =>Print[585];
 ENDCASE =>Print[586];--:740----893:
33,34,37,55,45,50,36,43,54,48,51,52 =>PrintOp[M];--:893----1013:
30 =>PrintType[M];--:1013----1018:--82 =>IF M=0  THEN Print[777] ELSE Print[778];
--:1018----1024:--23 =>SELECT M FROM 0 =>Print[145];1 =>Print[146];2 =>Print[147];
 ENDCASE =>Print[784];--:1024----1027:
21 =>IF M=0  THEN Print[785] ELSE Print[786];--:1027----1037:
22 =>SELECT M FROM 0 =>Print[800];1 =>Print[801];2 =>Print[802];3 =>Print[803];
 ENDCASE =>Print[804];--:1037----1042:
31,62 =>BEGIN IF C=31  THEN Print[807] ELSE Print[808];Print[809];
Print[Hash↑[M].Rh]; END;41 =>IF M=0  THEN Print[810] ELSE Print[811];
10 =>Print[812];53,44,49 =>BEGIN PrintCmdMod[16,C];Print[813];PrintLn[];
ShowTokenList[Mem[Mem[M]↑.Hh.Rh]↑.Hh.Rh,0,1000,0]; END;5 =>Print[814];
40 =>Print[IntName↑[M]];--:1042----1052:
68 =>IF M=1  THEN Print[821] ELSE IF M=0  THEN Print[822] ELSE Print[823];
66 =>IF M=6  THEN Print[824] ELSE Print[825];
67 =>IF M=0  THEN Print[826] ELSE Print[827];--:1052----1079:
25 =>IF M<1  THEN Print[857] ELSE IF M=1  THEN Print[858] ELSE Print[859];
--:1079----1101:--20 =>SELECT M FROM 0 =>Print[869];1 =>Print[870];2 =>Print[871];
3 =>Print[872]; ENDCASE =>Print[873];--:1101----1109:
76 =>IF M=0  THEN Print[890] ELSE Print[891];--:1109----1179:
29 =>IF M=16  THEN Print[914] ELSE Print[913];--:1179-- ENDCASE =>Print[469];
 END;--:624-- 
 PrintCapsule: PROCEDURE
 = 
BEGIN PrintChar[40];PrintExp[GPointer,0];PrintChar[41]; END;
  TokenRecycle: PROCEDURE = 
BEGIN RecycleValue[GPointer]; END;--:224----1204:

END.