-- MakeFileIDsImpl.mesa          Last edit: KK          October 26, 1982 12:51 pm

DIRECTORY

      AlpineEnvironment
         USING[FileID],
      File,
      FileIO
         USING[Open],
      FilePageMgr
         USING[GenerateFileID],
      IO
         USING[card, Close, Handle, PutF],
      Rope
	    USING[ROPE],
      SystemInternal
	    USING[UniversalID];


MakeFileIDsImpl: PROGRAM
  IMPORTS AE: AlpineEnvironment, FileIO, FilePageMgr, IO 
  SHARES File =


BEGIN
  
   
NFiles: CARDINAL = 50;
   
PutFileID: PROCEDURE[fileID: AE.FileID] =
   BEGIN
   uid: SystemInternal.UniversalID ← LOOPHOLE[fileID];
   resultsStreamHandle.PutF["*n%5g %5g %5g %10g ",
      IO.card[uid.processor.a], IO.card[uid.processor.b],
      IO.card[uid.processor.c], IO.card[uid.sequence]];
   END;
   
Main: PROCEDURE =
   BEGIN -- set up to call from CoPilot for debugging.
   foo: CARDINAL ← 0;
   BEGIN
   ENABLE ANY => foo ← foo + 1; -- protect us from the tempcedarexec.
   
   fileID: AE.FileID;
   resultsStreamHandle ← FileIO.Open["MakeFileIDs.Results",
      overwrite, none];
   resultsStreamHandle.PutF["*n%3g", IO.card[NFiles]];
   FOR index: CARDINAL IN [0.. NFiles)
      DO fileID ← FilePageMgr.GenerateFileID[];
      PutFileID[fileID];
      ENDLOOP;  
   
   resultsStreamHandle.Close[];
   
   END;
   END;
   
   
      
-- main line code:


resultsStreamHandle: IO.Handle;

END.