Archives.mesa
Copyright Ó 1990, 1992 by Xerox Corporation. All rights reserved.
Chauser, December 3, 1990 2:06 pm PST
DIRECTORY
Rope USING [ROPE],
IO USING [STREAM];
Archives: CEDAR DEFINITIONS
~ BEGIN
ROPE: TYPE ~ Rope.ROPE;
STREAM: TYPE ~ IO.STREAM;
Handle: TYPE = REF HandleRecord;
OpenDirectory: PROC [directory: ROPE ¬ NIL, msg: STREAM ¬ NIL] RETURNS [h: Handle];
Opening is unreasonably expensive; if possible, use a single handle for many operations.
CloseDirectory: PROC [h: Handle];
ArchiveConsumer: TYPE ~ PROC[ line: ROPE ] RETURNS [ continue: BOOL ¬ TRUE ];
The line returned consists of: the file name, the file date, information about where in the archives the file is stored, and the file state (which should always be "completed"). The fields are separated by '\t (tab) characters.
EnumerateDirectory: PROC [h: Handle, pattern: ROPE, consumer: ArchiveConsumer];
Enumerate files matching pattern, passing the line for each to the consumer.
Parameters: TYPE = REF ParametersRecord;
ParametersRecord: TYPE = RECORD [fileName: ROPE ¬ NIL];
The filename is taken from the user profile entry "Archives.DirectoryName" if any, otherwise defaults to a value given in the implementation.
GetParameters: PROC RETURNS [Parameters];
Tells various information about why Archives behave as they do. Currently, just tells which file is being used as the directory.
HandleRecord: PRIVATE TYPE = RECORD [
fileName: ROPE,
msg: STREAM,
lastSegCount: CARD,
nSegments: CARD,
starts: Starts,
compressedInput: STREAM
] ¬ [NIL, NIL, 0, 0, NIL, NIL];
Starts: PRIVATE TYPE ~ REF StartSequence;
StartSequence: PRIVATE TYPE ~ RECORD [
SEQUENCE len: CARD OF StartRecord
];
StartRecord: PRIVATE TYPE ~ RECORD [
keyPos, segPos: CARD,
key: ROPE
];
END.