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


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

TexScan2Impl: PROGRAM IMPORTS PascalBasic, TexTypes, TexInteraction, TexBuildPage, TexMemory, TexSymbols, TexScan, TexOps, TexRest, TexSysdepInline EXPORTS TexScan = PUBLIC
BEGIN OPEN PascalBasic, PascalWizardFiles, TexSysdep, TexTypes, TexInteraction, TexBuildPage, TexMemory, TexSymbols, TexScan, TexOps, TexRest, TexSysdepInline;
--413:-- ScanSomethingInternal: PROCEDURE[Level: SmallNumber,
Negative: PascalBoolean] = 
BEGIN M:Halfword;P:PascalInteger[0..NestSize]; M←CurChr;
SELECT CurCmd FROM 84 =>--414:--BEGIN ScanSevenBitInt[];
IF M=4639  THEN BEGIN CurVal←Eqtb↑[4639+CurVal].Hh.Rh;CurValLevel←0;
 END  ELSE IF  INT[M]<4639  THEN BEGIN CurVal←Eqtb↑[M+CurVal].Hh.Rh;
CurValLevel←0; END  ELSE BEGIN CurVal←Eqtb↑[M+CurVal].Int;
CurValLevel←0; END; END--:414--;70,71,85,86,87 =>--415:
IF Level#5  THEN BEGIN BEGIN IF Interaction=3  THEN NULL;PrintNl[134];
Print[525]; END;BEGIN HelpPtr←3;HelpLine↑[2]←526;HelpLine↑[1]←527;
HelpLine↑[0]←528; END;BackError[];BEGIN CurVal←0;CurValLevel←1; END;
 END  ELSE IF  INT[CurCmd]<=71  THEN BEGIN IF  INT[CurCmd]<71  THEN BEGIN
ScanEightBitInt[];M←3566+CurVal; END;BEGIN CurVal←Eqtb↑[M].Hh.Rh;
CurValLevel←5; END; END  ELSE BEGIN BackInput[];ScanFontIdent[];
BEGIN CurVal←2768+CurVal;CurValLevel←4; END; END--:415--;
72 =>BEGIN CurVal←Eqtb↑[M].Int;CurValLevel←0; END;
73 =>BEGIN CurVal←Eqtb↑[M].Int;CurValLevel←1; END;
74 =>BEGIN CurVal←Eqtb↑[M].Hh.Rh;CurValLevel←2; END;
75 =>BEGIN CurVal←Eqtb↑[M].Hh.Rh;CurValLevel←3; END;78 =>--418:
IF ABS[CurList.ModeField]#M  THEN BEGIN BEGIN IF Interaction=3  THEN NULL;
PrintNl[134];Print[539]; END;PrintCmdChr[78,M];BEGIN HelpPtr←4;
HelpLine↑[3]←540;HelpLine↑[2]←541;HelpLine↑[1]←542;HelpLine↑[0]←543;
 END;Error[];IF Level#5  THEN BEGIN CurVal←0;CurValLevel←1;
 END  ELSE BEGIN CurVal←0;CurValLevel←0; END;
 END  ELSE BEGIN CurVal←CurList.AuxField;
IF M=1  THEN CurValLevel←1  ELSE CurValLevel←0; END--:418--;79 =>--422:
BEGIN Nest↑[NestPtr]←CurList;P←NestPtr;
WHILE ABS[Nest↑[P].ModeField]#1 DO P←P-1 ENDLOOP ;
BEGIN CurVal←Nest↑[P].PgField;CurValLevel←0; END; END--:422--;81 =>--419:
BEGIN IF M=0  THEN CurVal←DeadCycles  ELSE CurVal←InsertPenalties;
CurValLevel←0; END--:419--;80 =>--421:
BEGIN IF PageContents=0  THEN IF M=0  THEN CurVal←1073741823  ELSE
CurVal←0  ELSE CurVal←PageSoFar↑[M];CurValLevel←1; END--:421--;
83 =>--423:
BEGIN IF Eqtb↑[3556].Hh.Rh=0  THEN CurVal←0  ELSE CurVal←Mem[Eqtb↑[3556]
.Hh.Rh]↑.Hh.Lh;CurValLevel←0; END--:423--;82 =>--420:
BEGIN ScanEightBitInt[];
IF Eqtb↑[3822+CurVal].Hh.Rh=0  THEN CurVal←0  ELSE CurVal←Mem[ INT[Eqtb↑
[3822+CurVal].Hh.Rh]+M]↑.Int;CurValLevel←1; END--:420--;
67,68 =>BEGIN CurVal←CurChr;CurValLevel←0; END;76 =>--425:
BEGIN FindFontDimen[FALSE];FontInfo↑[FmemPtr].Int←0;
BEGIN CurVal←FontInfo↑[CurVal].Int;CurValLevel←1; END; END--:425--;
77 =>--426:--BEGIN ScanFontIdent[];
IF M=0  THEN BEGIN CurVal←HyphenChar↑[CurVal];CurValLevel←0;
 END  ELSE BEGIN CurVal←SkewChar↑[CurVal];CurValLevel←0; END;
 END--:426--;88 =>--427:--BEGIN ScanEightBitInt[];
SELECT M FROM 0 =>CurVal←Eqtb↑[4817+CurVal].Int;
1 =>CurVal←Eqtb↑[5221+CurVal].Int;2 =>CurVal←Eqtb↑[3044+CurVal].Hh.Rh;
3 =>CurVal←Eqtb↑[3300+CurVal].Hh.Rh; ENDCASE;CurValLevel←M; END--:427--;
69 =>--424:--BEGIN IF CurChr=2  THEN CurVal←0  ELSE CurVal←0;
CurValLevel←CurChr;
IF NOT ( INT[CurList.TailField]>=HiMemMin)AND (CurList.ModeField#0) THEN
SELECT CurChr FROM 0 =>IF Mem[CurList.TailField]↑.Hh.B0=12  THEN CurVal←Mem
[CurList.TailField+1]↑.Int;
1 =>IF Mem[CurList.TailField]↑.Hh.B0=11  THEN CurVal←Mem[CurList.
TailField+1]↑.Int;
2 =>IF Mem[CurList.TailField]↑.Hh.B0=10  THEN BEGIN CurVal←Mem[CurList.
TailField+1]↑.Hh.Lh;
IF Mem[CurList.TailField]↑.Hh.B1=99  THEN CurValLevel←3; END;
 ENDCASE  ELSE IF(CurList.ModeField=1)AND (CurList.TailField=CurList.
HeadField) THEN SELECT CurChr FROM 0 =>CurVal←LastPenalty;
1 =>CurVal←LastKern;2 =>IF LastGlue#65515  THEN CurVal←LastGlue; ENDCASE;
 END--:424--; ENDCASE =>--428:--BEGIN BEGIN IF Interaction=3  THEN NULL;PrintNl[134];
Print[544]; END;PrintCmdChr[CurCmd,CurChr];Print[545];PrintEsc[398];
BEGIN HelpPtr←1;HelpLine↑[0]←543; END;Error[];
IF Level#5  THEN BEGIN CurVal←0;CurValLevel←1;
 END  ELSE BEGIN CurVal←0;CurValLevel←0; END; END--:428--;
WHILE  INT[CurValLevel]>Level DO--429:
BEGIN IF CurValLevel=2  THEN CurVal←Mem[CurVal+1]↑.Int  ELSE IF
CurValLevel=3  THEN MuError[];CurValLevel←CurValLevel-1; END--:429-- ENDLOOP ;
--430:--IF Negative  THEN IF  INT[CurValLevel]>=2  THEN BEGIN CurVal←NewSpec[
CurVal];--431:--BEGIN Mem[CurVal+1]↑.Int←-Mem[CurVal+1]↑.Int;
Mem[CurVal+2]↑.Int←-Mem[CurVal+2]↑.Int;
Mem[CurVal+3]↑.Int←-Mem[CurVal+3]↑.Int; END--:431--;
 END  ELSE CurVal←-CurVal  ELSE IF( INT[CurValLevel]>=2)AND ( INT[CurValLevel]<=3
) THEN Mem[CurVal]↑.Hh.Rh←Mem[CurVal]↑.Hh.Rh+1--:430--; END;--:413----440:
 ScanDimen: PROCEDURE[Mu,Inf,Shortcut: PascalBoolean]
 = 
BEGIN  Negative:PascalBoolean;F:PascalInteger;--450:
Num, Denom:PascalInteger;K:SmallNumber;V:Scaled;SaveCurVal:PascalInteger;--:450
  
 --443:-- F←0;ArithError←FALSE;CurOrder←0;Negative←FALSE;
{IF  NOT Shortcut  THEN BEGIN--441:--Negative←FALSE;DO--406:
DO GetXToken[]; IF CurCmd#10--:406-- THEN EXIT; ENDLOOP;
IF CurTok=3117  THEN BEGIN Negative← NOT Negative;CurTok←3115; END;
 IF CurTok#3115--:441-- THEN EXIT; ENDLOOP;IF( INT[CurCmd]>=67)AND ( INT[CurCmd]<=88) THEN--449:
IF Mu  THEN BEGIN ScanSomethingInternal[3,FALSE];--451:
IF  INT[CurValLevel]>=2  THEN BEGIN V←Mem[CurVal+1]↑.Int;
DeleteGlueRef[CurVal];CurVal←V; END--:451--;
IF CurValLevel=3  THEN  GOTO Label89;IF CurValLevel#0  THEN MuError[];
 END  ELSE BEGIN ScanSomethingInternal[1,FALSE];
IF CurValLevel=1  THEN  GOTO Label89; END--:449-- ELSE BEGIN BackInput[];
IF CurTok=3116  THEN CurTok←3118;
IF CurTok#3118  THEN ScanInt [] ELSE BEGIN Radix←10;CurVal←0; END;
IF CurTok=3116  THEN CurTok←3118;
IF(Radix=10)AND (CurTok=3118) THEN--452:--BEGIN K←0;GetToken[];
{WHILE TRUE DO BEGIN GetXToken[];
IF( INT[CurTok]>3129)OR ( INT[CurTok]<3120) THEN  GOTO Label31;
IF  INT[K]<17  THEN BEGIN Dig↑[K]← INT[CurTok]-3120;K←K+1; END; END ENDLOOP ;
EXITS Label31 => NULL};F←RoundDecimals[K];IF CurCmd#10  THEN BackInput[]; END--:452--; END;
 END;IF CurVal<0  THEN BEGIN Negative← NOT Negative;CurVal←-CurVal;
 END;--453:--{{IF Inf  THEN--454:--IF ScanKeyword[183] THEN BEGIN CurOrder←1;
WHILE ScanKeyword[108]DO BEGIN IF CurOrder=3  THEN BEGIN BEGIN IF
Interaction=3  THEN NULL;PrintNl[134];Print[565]; END;Print[566];
BEGIN HelpPtr←1;HelpLine↑[0]←567; END;Error[];
 END  ELSE CurOrder←CurOrder+1; END ENDLOOP ; GOTO Label88; END--:454--;--455:
SaveCurVal←CurVal;--406:--DO GetXToken[]; IF CurCmd#10--:406-- THEN EXIT; ENDLOOP;
{{IF( INT[CurCmd]<67)OR ( INT[CurCmd]>88) THEN BackInput [] ELSE BEGIN IF Mu  THEN BEGIN
ScanSomethingInternal[3,FALSE];--451:
IF  INT[CurValLevel]>=2  THEN BEGIN V←Mem[CurVal+1]↑.Int;
DeleteGlueRef[CurVal];CurVal←V; END--:451--;
IF CurValLevel#3  THEN MuError[];
 END  ELSE ScanSomethingInternal[1,FALSE];V←CurVal; GOTO Label40; END;
IF Mu  THEN  GOTO Label45;IF ScanKeyword[568] THEN V←(--558:
FontInfo↑[6+ParamBase↑[Eqtb↑[4078].Hh.Rh]].Int--:558
) ELSE IF ScanKeyword[569] THEN V←(--559:
FontInfo↑[5+ParamBase↑[Eqtb↑[4078].Hh.Rh]].Int--:559--) ELSE  GOTO Label45;--443:
BEGIN GetXToken[];IF CurCmd#10  THEN BackInput[]; END--:443--;
EXITS Label40 => NULL};CurVal←NxPlusY[SaveCurVal,V,XnOverD[V,F,65536]]; GOTO Label89;
EXITS Label45 => NULL};--:455--IF Mu  THEN--456:
IF ScanKeyword[209] THEN  GOTO Label88  ELSE BEGIN BEGIN IF Interaction=3  THEN NULL;
PrintNl[134];Print[565]; END;Print[570];BEGIN HelpPtr←4;
HelpLine↑[3]←571;HelpLine↑[2]←572;HelpLine↑[1]←573;HelpLine↑[0]←574;
 END;Error[]; GOTO Label88; END--:456--;IF ScanKeyword[564] THEN--457:
BEGIN PrepareMag[];
IF Eqtb↑[4784].Int#1000  THEN BEGIN CurVal←XnOverD[CurVal,1000,Eqtb↑
[4784].Int];F← (1000*F+65536*Remainder)/Eqtb↑[4784].Int;
CurVal←CurVal+( PascalDIVPower2[F ,16]);F← PascalMODPower2Mask[F ,65535]; END; END--:457--;
IF ScanKeyword[265] THEN  GOTO Label88;--458:
{IF ScanKeyword[575] THEN BEGIN Num←7227;Denom←100;
 END  ELSE IF ScanKeyword[576] THEN BEGIN Num←12;Denom←1;
 END  ELSE IF ScanKeyword[577] THEN BEGIN Num←7227;Denom←254;
 END  ELSE IF ScanKeyword[578] THEN BEGIN Num←7227;Denom←2540;
 END  ELSE IF ScanKeyword[579] THEN BEGIN Num←7227;Denom←7200;
 END  ELSE IF ScanKeyword[580] THEN BEGIN Num←1238;Denom←1157;
 END  ELSE IF ScanKeyword[581] THEN BEGIN Num←14856;Denom←1157;
 END  ELSE IF ScanKeyword[582] THEN  GOTO Label30  ELSE--459:
BEGIN BEGIN IF Interaction=3  THEN NULL;PrintNl[134];Print[565]; END;
Print[583];BEGIN HelpPtr←6;HelpLine↑[5]←584;HelpLine↑[4]←585;
HelpLine↑[3]←586;HelpLine↑[2]←572;HelpLine↑[1]←573;HelpLine↑[0]←574;
 END;Error[]; GOTO Label32; END--:459--;CurVal←XnOverD[CurVal,Num,Denom];
F← (Num*F+65536*Remainder)/Denom;CurVal←CurVal+( PascalDIVPower2[F ,16]);
F← PascalMODPower2Mask[F ,65535];EXITS Label32 => NULL};--:458--EXITS Label88 => NULL};IF CurVal>=16384  THEN ArithError←TRUE  ELSE CurVal←
CurVal*65536+F;EXITS Label30 => NULL};--:453--BEGIN GetXToken[];IF CurCmd#10  THEN BackInput[];
 END--:443--;EXITS Label89 => NULL};IF ArithError OR (ABS[CurVal]>=1073741824) THEN--460:
BEGIN BEGIN IF Interaction=3  THEN NULL;PrintNl[134];Print[587]; END;
BEGIN HelpPtr←2;HelpLine↑[1]←588;HelpLine↑[0]←589; END;Error[];
CurVal←1073741823;ArithError←FALSE; END--:460--;
IF Negative  THEN CurVal←-CurVal; END;--:448----461:
 ScanGlue: PROCEDURE[Level: SmallNumber] = 
BEGIN  Negative:PascalBoolean;
Q:Halfword;Mu:PascalBoolean; Mu←(Level=3);--441:--Negative←FALSE;
DO--406:--DO GetXToken[]; IF CurCmd#10--:406-- THEN EXIT; ENDLOOP;
IF CurTok=3117  THEN BEGIN Negative← NOT Negative;CurTok←3115; END;
 IF CurTok#3115--:441-- THEN EXIT; ENDLOOP;
{IF( INT[CurCmd]>=67)AND ( INT[CurCmd]<=88) THEN BEGIN ScanSomethingInternal[Level,
Negative];
IF  INT[CurValLevel]>=2  THEN BEGIN IF CurValLevel#Level  THEN MuError[];
 GOTO Label10; END;
IF CurValLevel=0  THEN ScanDimen[Mu,FALSE,TRUE] ELSE IF Level=3  THEN
MuError[]; END  ELSE BEGIN BackInput[];ScanDimen[Mu,FALSE,FALSE];
IF Negative  THEN CurVal←-CurVal; END;--462:--Q←NewSpec[0];
Mem[Q+1]↑.Int←CurVal;
IF ScanKeyword[590] THEN BEGIN ScanDimen[Mu,TRUE,FALSE];
Mem[Q+2]↑.Int←CurVal;Mem[Q]↑.Hh.B0←CurOrder; END;
IF ScanKeyword[591] THEN BEGIN ScanDimen[Mu,TRUE,FALSE];
Mem[Q+3]↑.Int←CurVal;Mem[Q]↑.Hh.B1←CurOrder; END;CurVal←Q--:462--;
EXITS Label10 => NULL}; END;--:461----463:--
END.