-- file: TexMemory3Impl.mesa
-- Pascal-to-Mesa translator output, translated at September 27, 1985 10:21:37 am PDT


DIRECTORY
  PascalBasic,
  TexTypes,
  TexInteraction,
  TexMemory,
  TexSymbols,
  TexBuildPage,
  TexScan,
  TexOps,
  TexExtensions,
  TexRest,
  TexSysdep,
  TexSysdepInline;

TexMemory3Impl: PROGRAM IMPORTS TexTypes, TexInteraction, TexMemory, TexSymbols, TexBuildPage, TexRest, TexSysdep, TexSysdepInline EXPORTS TexMemory = PUBLIC
BEGIN OPEN PascalBasic, TexTypes, TexInteraction, TexMemory, TexSymbols, TexBuildPage, TexScan, TexOps, TexExtensions, TexRest, TexSysdep, TexSysdepInline;
 PrintSkipParam: PROCEDURE[N: PascalInteger]
 = 
BEGIN SELECT N FROM 0 =>PrintEsc[244];1 =>PrintEsc[245];2 =>PrintEsc[246];
3 =>PrintEsc[247];4 =>PrintEsc[248];5 =>PrintEsc[249];6 =>PrintEsc[250];
7 =>PrintEsc[251];8 =>PrintEsc[252];9 =>PrintEsc[253];10 =>PrintEsc[254];
11 =>PrintEsc[255];12 =>PrintEsc[256];13 =>PrintEsc[257];14 =>PrintEsc[258];
15 =>PrintEsc[259];16 =>PrintEsc[260];17 =>PrintEsc[261];
 ENDCASE =>Print[262]; END;--:225----:179----182:
 CopyNodeList: PROCEDURE[P: Halfword] RETURNS[CopyNodeListResult: Halfword] = 
BEGIN H:Halfword;Q:Halfword;
R:Halfword;Words:PascalInteger[0..5]; H←GetAvail[];Q←H;WHILE P#0 DO BEGIN--205:
Words←1;IF( INT[P]>=HiMemMin) THEN R←GetAvail [] ELSE--206:
SELECT Mem[P]↑.Hh.B0 FROM 0,1,13 =>BEGIN R←GetNode[7];Mem[R+6]↑←Mem[P+6]↑;
Mem[R+5]↑←Mem[P+5]↑;Mem[R+5]↑.Hh.Rh←CopyNodeList[Mem[P+5]↑.Hh.Rh];
Words←5; END;2 =>BEGIN R←GetNode[4];Words←4; END;3 =>BEGIN R←GetNode[5];
Mem[R+4]↑←Mem[P+4]↑;
Mem[Mem[P+4]↑.Hh.Rh]↑.Hh.Rh←Mem[Mem[P+4]↑.Hh.Rh]↑.Hh.Rh+1;
Mem[R+4]↑.Hh.Lh←CopyNodeList[Mem[P+4]↑.Hh.Lh];Words←4; END;8 =>--1357:
SELECT Mem[P]↑.Hh.B1 FROM 0 =>BEGIN R←GetNode[3];Words←3; END;
1,3 =>BEGIN R←GetNode[2];
Mem[Mem[P+1]↑.Hh.Rh]↑.Hh.Lh←Mem[Mem[P+1]↑.Hh.Rh]↑.Hh.Lh+1;Words←2; END;
2 =>BEGIN R←GetNode[2];Words←2; END; ENDCASE =>Confusion[1141]--:1357--;
10 =>BEGIN R←GetNode[2];
Mem[Mem[P+1]↑.Hh.Lh]↑.Hh.Rh←Mem[Mem[P+1]↑.Hh.Lh]↑.Hh.Rh+1;
Mem[R+1]↑.Hh.Lh←Mem[P+1]↑.Hh.Lh;
Mem[R+1]↑.Hh.Rh←CopyNodeList[Mem[P+1]↑.Hh.Rh]; END;
11,9,12 =>BEGIN R←GetNode[2];Words←2; END;6 =>BEGIN R←GetNode[2];
Mem[R+1]↑←Mem[P+1]↑;Mem[R+1]↑.Hh.Rh←CopyNodeList[Mem[P+1]↑.Hh.Rh]; END;
7 =>BEGIN R←GetNode[2];Mem[R+1]↑.Hh.Lh←CopyNodeList[Mem[P+1]↑.Hh.Lh];
Mem[R+1]↑.Hh.Rh←CopyNodeList[Mem[P+1]↑.Hh.Rh]; END;
4 =>BEGIN R←GetNode[2];
Mem[Mem[P+1]↑.Int]↑.Hh.Lh←Mem[Mem[P+1]↑.Int]↑.Hh.Lh+1;Words←2; END;
5 =>BEGIN R←GetNode[2];Mem[R+1]↑.Int←CopyNodeList[Mem[P+1]↑.Int]; END;
 ENDCASE =>Confusion[225]--:206--;WHILE  INT[Words]>0 DO BEGIN Words←Words-1;
Mem[R+Words]↑←Mem[P+Words]↑; END--:205-- ENDLOOP ;Mem[Q]↑.Hh.Rh←R;Q←R;
P←Mem[P]↑.Hh.Rh; END ENDLOOP ;Mem[Q]↑.Hh.Rh←0;Q←Mem[H]↑.Hh.Rh;
BEGIN Mem[H]↑.Hh.Rh←Avail;Avail←H;DynUsed←DynUsed-1; END;
CopyNodeListResult←Q; END;--:204----211:-- PrintMode: PROCEDURE[M: PascalInteger]
 = 
BEGIN IF M>0  THEN SELECT M /(100)FROM 0 =>Print[226];1 =>Print[227];
2 =>Print[228];
 ENDCASE  ELSE IF M=0  THEN Print[229] ELSE SELECT(-M)/(100)FROM 0 =>Print[230];
1 =>Print[231];2 =>Print[214]; ENDCASE;Print[232]; END;--:211----216:
 PushNest: PROCEDURE
 = 
BEGIN IF  INT[NestPtr]>MaxNestStack  THEN BEGIN MaxNestStack←NestPtr;
IF NestPtr=NestSize  THEN Overflow[233,NestSize]; END;
Nest↑[NestPtr]←CurList;NestPtr←NestPtr+1;
CurList.HeadField←GetAvail[];CurList.TailField←CurList.HeadField;
CurList.PgField←0;CurList.MlField←Line; END;--:216----217:
 PopNest: PROCEDURE = 
BEGIN BEGIN Mem[CurList.HeadField]↑.Hh.Rh←Avail;
Avail←CurList.HeadField;DynUsed←DynUsed-1; END;
NestPtr←NestPtr-1;CurList←Nest↑[NestPtr]; END;--:217----218:
 ShowActivities: PROCEDURE
 = 
BEGIN P:PascalInteger[0..NestSize];M:PascalInteger[-201..201];A:PascalInteger;Q, R:Halfword;T:PascalInteger;
 Nest↑[NestPtr]←CurList;PrintNl[210];PrintLn[];
FOR i:INT    DECREASING IN [ INT[0 ].. INT[NestPtr ]] DO  P ← i;  M←Nest↑[P].ModeField;
A←Nest↑[P].AuxField;PrintNl[234];PrintMode[M];Print[235];
PrintInt[ABS[Nest↑[P].MlField]];IF Nest↑[P].MlField<0  THEN Print[236];
IF P=0  THEN BEGIN--986:--IF 64998#PageTail  THEN BEGIN PrintNl[833];
IF OutputActive  THEN Print[834];ShowBox[Mem[64998]↑.Hh.Rh];
IF  INT[PageContents]>0  THEN BEGIN PrintNl[835];PrintTotals[];PrintNl[836];
PrintScaled[PageSoFar↑[0]];R←Mem[65000]↑.Hh.Rh;
WHILE R#65000 DO BEGIN PrintLn[];PrintEsc[202];T←Mem[R]↑.Hh.B1;
PrintInt[T];Print[837];T←XOverN[Mem[R+3]↑.Int,1000]*Eqtb↑[4817+T].Int;
PrintScaled[T];IF Mem[R]↑.Hh.B0=1  THEN BEGIN Q←64998;T←0;
DO Q←Mem[Q]↑.Hh.Rh;
IF(Mem[Q]↑.Hh.B0=3)AND (Mem[Q]↑.Hh.B1=Mem[R]↑.Hh.B1) THEN T←T+1;
 IF Q=Mem[R+1]↑.Hh.Lh THEN EXIT; ENDLOOP;Print[838];PrintInt[T];Print[839]; END;
R←Mem[R]↑.Hh.Rh; END ENDLOOP ; END; END--:986--;
IF Mem[64999]↑.Hh.Rh#0  THEN PrintNl[237]; END;
ShowBox[Mem[Nest↑[P].HeadField]↑.Hh.Rh];--219:
SELECT ABS[M]/(100)FROM 0 =>BEGIN PrintNl[238];
IF A<=-65536000  THEN Print[239] ELSE PrintScaled[A];
IF Nest↑[P].PgField#0  THEN BEGIN Print[240];
PrintInt[Nest↑[P].PgField];Print[241];
IF Nest↑[P].PgField#1  THEN PrintChar[115]; END; END;
1 =>BEGIN PrintNl[242];PrintInt[A]; END;2 =>IF A#0  THEN BEGIN Print[243];
ShowBox[A]; END; ENDCASE--:219--; ENDLOOP; END;--:218----237:
 PrintParam: PROCEDURE[N: PascalInteger] = 
BEGIN SELECT N FROM 0 =>PrintEsc[288];
1 =>PrintEsc[289];2 =>PrintEsc[290];3 =>PrintEsc[291];4 =>PrintEsc[292];
5 =>PrintEsc[293];6 =>PrintEsc[294];7 =>PrintEsc[295];8 =>PrintEsc[296];
9 =>PrintEsc[297];10 =>PrintEsc[298];11 =>PrintEsc[299];12 =>PrintEsc[300];
13 =>PrintEsc[301];14 =>PrintEsc[302];15 =>PrintEsc[303];16 =>PrintEsc[304];
17 =>PrintEsc[305];18 =>PrintEsc[306];19 =>PrintEsc[307];20 =>PrintEsc[308];
21 =>PrintEsc[309];22 =>PrintEsc[310];23 =>PrintEsc[311];24 =>PrintEsc[312];
25 =>PrintEsc[313];26 =>PrintEsc[314];27 =>PrintEsc[315];28 =>PrintEsc[316];
29 =>PrintEsc[317];30 =>PrintEsc[318];31 =>PrintEsc[319];32 =>PrintEsc[320];
33 =>PrintEsc[321];34 =>PrintEsc[322];35 =>PrintEsc[323];36 =>PrintEsc[324];
37 =>PrintEsc[325];38 =>PrintEsc[326];39 =>PrintEsc[327];40 =>PrintEsc[328];
41 =>PrintEsc[329];42 =>PrintEsc[330];43 =>PrintEsc[331];44 =>PrintEsc[332];
45 =>PrintEsc[333];46 =>PrintEsc[334];47 =>PrintEsc[335];48 =>PrintEsc[336];
49 =>PrintEsc[337]; ENDCASE =>Print[338]; END;--:237----241:
 FixDateAndTime: PROCEDURE
 = 
BEGIN ReadTheClock[@Eqtb↑[4787].Int,@Eqtb↑[4788].Int,@Eqtb↑[4789].Int,@Eqtb↑
[4790].Int]; END;--:241----245:-- BeginDiagnostic: PROCEDURE
 = 
BEGIN OldSetting←Selector;IF History=0  THEN History←1;
IF(Eqtb↑[4796].Int<=0)AND (Selector=19) THEN Selector←Selector-1; END;
 EndDiagnostic: PROCEDURE[BlankLine: PascalBoolean] = 
BEGIN PrintNl[210];
IF BlankLine  THEN PrintLn[];Selector←OldSetting; END;--:245----247:

END.