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


DIRECTORY
  PascalBasic,
  PascalWizardFiles,
  MFTypes,
  MFInit,
  MFExternals,
  MFInteraction,
  MFMath,
  MFSymbols,
  MFInput,
  MFFileNames,
  MFOps,
  MFRest;

MFMain: PROGRAM IMPORTS PascalBasic, PascalWizardFiles, MFInit, MFExternals, MFInteraction, MFMath, MFSymbols, MFInput, MFFileNames, MFOps, MFRest EXPORTS MFRest, MFTypes = PUBLIC
BEGIN OPEN PascalBasic, PascalWizardFiles, MFTypes, MFInit, MFExternals, MFInteraction, MFMath, MFSymbols, MFInput, MFFileNames, MFOps, MFRest;
 --4:----9:----$C-,A+,D- ----$C+,D+----:9-- --6:----:6

--:679----698:--
BgLoc: PascalInteger[1..2241];

EgLoc: PascalInteger[1..2241];

--:1187----1202:--
StartLikeInimf: PascalBoolean;
--:1211----:1201----1203:-- TheRealMf: PROCEDURE = 
BEGIN --1210:--  {ENABLE Error9999 => GOTO Label9999;{ENABLE Error9998 => GOTO Label9998;History←3;
RewriteTermOut[@TermOut];SetBackgroundPriority[];--14:--Bad←0;
IF( INT[HalfErrorLine]<30)OR ( INT[HalfErrorLine]>ErrorLine-15) THEN Bad←1;
IF  INT[MaxPrintLine]<60  THEN Bad←2;IF  PascalMODPower2Mask[GfBufSize ,7]#0  THEN Bad←3;
IF  INT[1100]>50000  THEN Bad←4;IF  INT[1777]>2100  THEN Bad←5;
IF  PascalMODPower2Mask[HeaderSize ,3]#0  THEN Bad←6;--:14----154:
IF MemMax#50000  THEN Bad←10;IF  INT[MemMax]<50000  THEN Bad←10;
IF( INT[0]>0)OR ( INT[255]<127) THEN Bad←11;IF( INT[0]>0)OR ( INT[65535]<32767) THEN Bad←12;
IF( INT[0]<0)OR ( INT[255]>65535) THEN Bad←13;IF( INT[0]<0)OR ( INT[MemMax]>=65535) THEN Bad←14;
IF  INT[MaxStrings]>65535  THEN Bad←15;IF  INT[BufSize]>65535  THEN Bad←16;
IF( INT[255]<255)OR ( INT[65535]<65535) THEN Bad←17;--:154----204:
IF  INT[2241+MaxInternal]>65535  THEN Bad←21;--:204----214:
IF  INT[2692]>65535  THEN Bad←22;--:214----310:
IF  INT[15*11]>BistackSize  THEN Bad←31;--:310----553:
IF  INT[20+17*45]>BistackSize  THEN Bad←32;--:553
IF Bad>0  THEN BEGIN {
PascalWriteLongString[file: @TermOut, item: "Ouch---my internal constants have been clobbered!"]; PascalWriteLongString[file: @TermOut, item: "---case "]; PascalWriteInteger[file: @TermOut, item: Bad, fieldMinLength: 1]; PascalWriteLn[file: @TermOut]};
 ERROR Error9999; END;Initialize[];
IF StartLikeInimf  THEN BEGIN IF  NOT GetStringsStarted [] THEN  ERROR Error9999
;InitTab[];InitPrim[]; END;--55:--Selector←1;Tally←0;TermOffset←0;
FileOffset←0;--:55----61:
PascalWriteLongString[file: @TermOut, item: "This is METAFONT 0.9999, for Cedar 6.0"];
IF BaseIdent=0  THEN {PascalWriteLongString[file: @TermOut, item: " (no base preloaded)"]; PascalWriteLn[file: @TermOut]} ELSE BEGIN
Print[BaseIdent];PrintLn[]; END;PascalTextBREAK[file: @TermOut];--:61----782:--JobName←0;
--:782----791:--OutputFileName←0;--:791--BEGIN--656:

 BEGIN InputPtr←0;MaxInStack←0;InOpen←0;MaxBufStack←0;
ParamPtr←0;MaxParamStack←0;First←1;CurInput.StartField←1;
CurInput.IndexField←0;Line←0;CurInput.NameField←0;
ForceEof←FALSE;IF  NOT InitTerminal [] THEN  ERROR Error9999;
CurInput.LimitField←Last;First←Last+1; END;--:656----659:
ScannerStatus←0;--:659--IF(BaseIdent=0)OR (Buffer↑[CurInput.LocField]=38) THEN BEGIN IF
BaseIdent#0  THEN Initialize[];IF  NOT OpenBaseFile [] THEN  ERROR Error9999;
IF  NOT LoadBaseFile [] THEN BEGIN WClose[@BaseFile]; ERROR Error9999; END;
WClose[@BaseFile];
WHILE( INT[CurInput.LocField]<CurInput.LimitField)AND (Buffer↑[CurInput.
LocField]=32)DO CurInput.LocField← INT[CurInput.LocField]+1 ENDLOOP ; END;
Buffer↑[CurInput.LimitField]←37;FixDateAndTime[];
InitRandoms[( PascalDIVPower2[Internal↑[17],16])+Internal↑[16]];--70:
IF Interaction=0  THEN Selector←0  ELSE Selector←1--:70--;
ReadProfileForDirectories[];
IF  INT[CurInput.LocField]<CurInput.LimitField  THEN IF Buffer↑[CurInput.
LocField]#92  THEN StartInput[]; END--:1210--;InitStrPtr←StrPtr;
InitPoolPtr←PoolPtr;MaxStrPtr←StrPtr;MaxPoolPtr←PoolPtr;
History←0;IF  INT[StartSym]>0  THEN BEGIN CurSym←StartSym;BackInput[]; END;
MainControl[];FinalCleanup[];EXITS Label9998 => NULL};CloseFilesAndTerminate[];EXITS Label9999 => NULL}; END;

Error9998: ERROR = CODE;

Error9999: ERROR = CODE;
 MFRun: UnsafeCommandProc = BEGIN 
RegisterMfCommands[];--:1203
 END;

PascalRegister["MF", MFRun];

END.