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


DIRECTORY
  PascalBasic,
  PascalWizardFiles,
  MFTypes,
  MFInteraction,
  MFSymbols,
  MFInput,
  MFFileNames;

MFFileNamesImpl: PROGRAM IMPORTS MFInteraction, MFSymbols, MFInput EXPORTS MFFileNames = PUBLIC
BEGIN OPEN PascalBasic, PascalWizardFiles, MFTypes, MFInteraction, MFSymbols, MFInput, MFFileNames;
--:751----766:--
CurName: StrNumber;

CurArea: StrNumber;


CurExt: StrNumber;
--:766----767:--
AreaDelimiter: PoolPointer;


ExtDelimiter: PoolPointer;
--:767----768:--
MfArea: StrNumber;
--:768----781:

JobName: StrNumber;

LogName: StrNumber;

--:784----790:--
GfFile: ByteFile;

OutputFileName: StrNumber;
 PrintFileName: PROCEDURE[N,A,E: PascalInteger] = 
BEGIN Print[A];Print[N];
Print[E]; END;--:772----73:-- BeginName: PROCEDURE
 = 
BEGIN AreaDelimiter←0;ExtDelimiter←0; END;--:769----770:
 MoreName: PROCEDURE[C: AsciiCode] RETURNS[MoreNameResult: PascalBoolean]
 = 
BEGIN IF C=32  THEN MoreNameResult←FALSE  ELSE BEGIN IF(C=62)OR (C=47)OR (C=93)
 THEN AreaDelimiter←PoolPtr  ELSE IF(C=46) THEN ExtDelimiter←PoolPtr;
BEGIN IF  INT[PoolPtr+1]>MaxPoolPtr  THEN BEGIN IF  INT[PoolPtr+1]>PoolSize  THEN
Overflow[129,PoolSize-InitPoolPtr];MaxPoolPtr←PoolPtr+1; END; END;
BEGIN StrPool↑[PoolPtr]←C;PoolPtr←PoolPtr+1; END;MoreNameResult←TRUE;
 END; END;--:770----771:-- EndName: PROCEDURE
 = 
BEGIN IF  INT[StrPtr+3]>MaxStrPtr  THEN BEGIN IF  INT[StrPtr+3]>MaxStrings  THEN
Overflow[130,MaxStrings-InitStrPtr];MaxStrPtr←StrPtr+3; END;
IF AreaDelimiter=0  THEN CurArea←157  ELSE BEGIN CurArea←StrPtr;
StrPtr←StrPtr+1;StrStart↑[StrPtr]←AreaDelimiter+1; END;
IF ExtDelimiter=0  THEN BEGIN CurExt←157;CurName←MakeString[];
 END  ELSE BEGIN CurName←StrPtr;StrPtr←StrPtr+1;
StrStart↑[StrPtr]←ExtDelimiter;CurExt←MakeString[]; END; END;--:771
--773:-- PackFileName: PROCEDURE[N,A,E: StrNumber] = 
BEGIN K:PascalInteger;
C:AsciiCode;J:PoolPointer; K←0;
FOR i:INT    IN [ INT[StrStart↑[A]].. INT[StrStart↑[A+1]-1 ]] DO  J ← i;  C←StrPool↑[J];K←K+1;
IF K<=FileNameSize  THEN NameOfFile↑[K]←Xchr↑[C]; ENDLOOP;
FOR i:INT    IN [ INT[StrStart↑[N]].. INT[StrStart↑[N+1]-1 ]] DO  J ← i;  C←StrPool↑[J];K←K+1;
IF K<=FileNameSize  THEN NameOfFile↑[K]←Xchr↑[C]; ENDLOOP;
FOR i:INT    IN [ INT[StrStart↑[E]].. INT[StrStart↑[E+1]-1 ]] DO  J ← i;  C←StrPool↑[J];K←K+1;
IF K<=FileNameSize  THEN NameOfFile↑[K]←Xchr↑[C]; ENDLOOP;
IF K<=FileNameSize  THEN NameLength←K  ELSE NameLength←
FileNameSize;
FOR i:INT    IN [ INT[NameLength+1 ].. INT[FileNameSize ]] DO  K ← i; NameOfFile↑[K]←'  ENDLOOP; END;
--:777----779:
 MakeNameString: PROCEDURE RETURNS[MakeNameStringResult: StrNumber] = 
BEGIN K:PascalInteger[1..FileNameSize];
 IF( INT[PoolPtr+NameLength]>PoolSize)OR (StrPtr=MaxStrings) THEN
MakeNameStringResult←63  ELSE BEGIN FOR i:INT    IN [ INT[1 ].. INT[NameLength ]] DO  K ← i; 
StrPool↑[PoolPtr]←Xord↑[NameOfFile↑[K]];PoolPtr←PoolPtr+1; ENDLOOP;
MakeNameStringResult←MakeString[]; END; END;
--:779
--780:-- ScanFileName: PROCEDURE = 
BEGIN  BeginName[];
WHILE Buffer↑[CurInput.LocField]=32 DO CurInput.LocField← INT[CurInput.
LocField]+1 ENDLOOP ;
{WHILE TRUE DO BEGIN IF(Buffer↑[CurInput.LocField]=59)OR (Buffer↑
[CurInput.LocField]=37) THEN  GOTO Label30;
IF  NOT MoreName[Buffer↑[CurInput.LocField]] THEN  GOTO Label30;
CurInput.LocField← INT[CurInput.LocField]+1; END ENDLOOP ;EXITS Label30 => NULL};EndName[]; END;--:780
--783:-- PackJobName: PROCEDURE[S: StrNumber] = 
BEGIN CurArea←157;
CurExt←S;CurName←JobName;PackFileName[CurName,CurArea,CurExt];
 END;--:783----785:-- PromptFileName: PROCEDURE[S,E: StrNumber] = 
BEGIN 
 K:PascalInteger[0..BufSize];  IF Interaction=2  THEN NULL;
IF S=608  THEN BEGIN IF Interaction=3  THEN NULL;PrintNl[133];Print[609];
 END  ELSE BEGIN IF Interaction=3  THEN NULL;PrintNl[133];Print[610]; END;
PrintFileName[CurName,CurArea,CurExt];Print[611];
IF E=612  THEN ShowContext[];PrintNl[613];Print[S];
IF  INT[Interaction]<2  THEN FatalError[614];BEGIN Print[615];TermInput[]; END;
--786:--BEGIN BeginName[];K←First;WHILE(Buffer↑[K]=32)AND ( INT[K]<Last)DO K←K+1 ENDLOOP ;
{WHILE TRUE DO BEGIN IF K=Last  THEN  GOTO Label30;
IF  NOT MoreName[Buffer↑[K]] THEN  GOTO Label30;K←K+1; END ENDLOOP ;EXITS Label30 => NULL};EndName[]; END--:786
;IF CurExt=157  THEN CurExt←E;
PackFileName[CurName,CurArea,CurExt]; END;--:785----787:

END.