-- dirman.mesa June 10, 1982 11:45 am
-- Interface to the directory component of the
-- Cedar Interim File System.
DIRECTORY
Rope: TYPE USING [ROPE];
DirMan: DEFINITIONS = {
-- DirMan manages the representation of directories
-- Exceptional conditions are reported with CIFS.Error
Dir: TYPE = REF DirObject;
DirObject: TYPE;
Open: PROC [name: Rope.ROPE, erase: BOOLEAN ← FALSE]
RETURNS[d: Dir];
-- Open a directory
Close: PROC [d: Dir];
-- Close a directory
Delete: PROC [d: Dir, name: Rope.ROPE];
-- Delete an entry in a directory
Destroy: PROC[d: Dir];
-- Destroy a directory
EProc: TYPE = PROC [name, link, comment: REF TEXT]
RETURNS [stop: BOOLEAN];
-- Procedure that is called for directory enumeration
-- If EProc returns T then the enumeration is halted
Enumerate: PROCEDURE [d: Dir, pattern: Rope.ROPE, p: EProc];
-- Enumerate the names in d that match pattern.
-- Pattern can contain "*" (match any sequence of characters)
-- Pattern can contain "#" (match exactly one arbitrary character)
-- The pattern "*" will enumerate the entire directory
Insert: PROCEDURE [d: Dir, name: Rope.ROPE, link: Rope.ROPE ← NIL,
comment: Rope.ROPE ← NIL];
-- Insert an entry in a directory
-- name is the entry name
-- if the entry is a link, then link is its target
-- comment is an optional comment for the entry
SetFlushMode: PROCEDURE [d: Dir, flush: BOOLEAN ← TRUE];
-- If flush is T, then the directory will be forced to disk after
-- every update operation
-- If flush is F, then the directory will not be forced to disk
-- In addtion, d.SetFlushMode[TRUE] flushes the directory
}..