-- AlpineImportMapImpl.mesa
-- Last edited by
--   MBrown on January 30, 1984 3:18:42 pm PST

  DIRECTORY
    AlpineEnvironment,
    AlpineImport,
    AlpineZones USING [static],
    BasicTime USING [earliestGMT, Now],
    Rope USING [Equal];

AlpineImportMapImpl: MONITOR
  IMPORTS
    AlpineZones,
    BasicTime,
    Rope
  EXPORTS
    AlpineImport
  = BEGIN

  head: AlpineImport.Handle ← NIL;

  Register: PUBLIC ENTRY PROC [server: AlpineEnvironment.FileStore]
    RETURNS [AlpineImport.Handle] = {
    handle: AlpineImport.Handle;
    FOR handle ← head, handle.rest UNTIL handle = NIL DO
      IF Rope.Equal[s1: handle.first.server, s2: server, case: FALSE] THEN {
        handle.first.mostRecentRegister ← BasicTime.Now[];
        RETURN[handle] };
      ENDLOOP;
    handle ← AlpineZones.static.CONS[rest: head, first: [
      server: server,
      mostRecentBind: BasicTime.earliestGMT,
      mostRecentRegister: BasicTime.Now[]]];
    head ← handle;
    RETURN[handle];
    };

  END.--AlpineImportMapImpl