-- RTFiles.mesa
-- Last Modified By Paul Rovner On December 16, 1982 8:25 pm

DIRECTORY
BcdDefs USING[VersionStamp],
CIFS USING[OpenFile],
File USING[Capability, ShowCapability],
Rope USING[ROPE],
VersionMap USING[MapList];

RTFiles: DEFINITIONS
IMPORTS File

= BEGIN OPEN File, Rope;

IsFileInUse: PROC[file: Capability] RETURNS[BOOLEAN];
-- Returns TRUE if the specified file is referenced either from the loadstate or
-- from the Cedar symbol cache or runtime type system. NOTE there are subtle
-- (and very unlikely) synchronization problems with this design.
-- This is really a job for SuperCIFS.

IncludeSymbolsVersionMap: PROC[fileName: ROPE];
-- causes VersionMap.RestoreMapFromFile to be applied to the specified file name,
-- and the resulting VersionMap.Map (if RestoreMapFromFile succeeds) to be
-- CONS'd onto the VersionMap.MapList used by the Cedar symbol-table access
-- machinery. This VersionMap.MapList is initialized to include the VersionMap in
-- the file named CedarSymbols.VersionMap if that file is on the local disk.

VersionToReadableFile: PROC[versionStamp: BcdDefs.VersionStamp,
shortNameHint: ROPENIL]
RETURNS[file: CIFS.OpenFile ← NIL];
-- This consults the current VersionMap.MapList to find the full path name associated with
-- the specified versionStamp and if one is found returns CIFS.Open[name, CIFS.read].
-- At present, the shortNameHint parameter is ignored.

GetMapList: PROC RETURNS[VersionMap.MapList];
-- This returns the current VersionMap.MapList.

SameFile: PROC[f1, f2: Capability] RETURNS[BOOLEAN] =
INLINE {RETURN[ShowCapability[f1].fID = ShowCapability[f2].fID]};

END.