Types:
LORA: TYPE = LIST OF REF ANY;
ROPE: TYPE = Rope.ROPE;
LOR: TYPE = LIST OF ROPE;
RopeMap: TYPE = TextReplace.RopeMap;
Viewer: TYPE = ViewerClasses.Viewer;
STREAM: TYPE = IO.STREAM;
GMT: TYPE = BasicTime.GMT;
VersionMapList: TYPE = VersionMap.MapList;
noGMT: GMT = BasicTime.nullGMT;
Error:
ERROR [message:
ROPE];
For syntax errors and such.
Warning:
SIGNAL [message:
ROPE];
For syntax errors and such.
Miss:
SIGNAL [name:
ROPE, created:
GMT];
Informational signal: Couldn't identify.
FileNote: TYPE = REF FileNoteRep;
FileNoteRep:
TYPE =
RECORD [
id: FileID,
fsName: ROPE ← NIL,
primaryVolume, backupVolume, author: ROPE ← NIL,
created, read, write: GMT ← noGMT,
createTried, readTried: BOOL ← FALSE];
FileID: TYPE = RECORD [name: ROPE, created: GMT ← noGMT];
FileSet: TYPE = REF FileSetRep;
FileSetRep:
TYPE =
RECORD [
elts: RedBlackTree.Table,
ids: IdentificationScheme,
summary: ROPE];
FileSetList: TYPE = LIST OF FileSet;
FileConsumer: TYPE = PROC [fn: FileNote];
IdentificationScheme:
TYPE =
RECORD [
server: BOOL ← TRUE,
directory: BOOL ← TRUE,
version: BOOL ← TRUE,
create: BOOL ← FALSE,
askFS: BOOL ← FALSE];
FileSet Operations:
NewFileSet: PROC [ids: IdentificationScheme ← []] RETURNS [fs: FileSet];
EnumSet: PROC [fs: FileSet, to: FileConsumer];
First: PROC [fs: FileSet] RETURNS [fn: FileNote];
Next: PROC [fs: FileSet, fn: FileNote] RETURNS [next: FileNote];
Lookup: PROC [fs: FileSet, fn: FileNote] RETURNS [found: FileNote];
Delete: PROC [fs: FileSet, fn: FileNote] RETURNS [found: FileNote];
Insert: PROC [fs: FileSet, fn: FileNote] RETURNS [news: BOOL];
Size: PROC [fs: FileSet] RETURNS [numberOfFiles: INT];
MapNames: PROC [fs: FileSet, map: RopeMap, mapIDName, mapFSName: BOOL ← TRUE] RETURNS [mfs: FileSet];
ReIdentify: PROC [fs: FileSet, ids: IdentificationScheme ← []] RETURNS [mfs: FileSet];
MapNameAndLookup: PROC [fs: FileSet, map: RopeMap, ids: IdentificationScheme ← []] RETURNS [mfs: FileSet];
pseudoServerToRead: RopeMap;
Realify:
PROC [fs: FileSet]
RETURNS [mfs: FileSet]
= INLINE {mfs ← MapNames[fs, pseudoServerToRead, TRUE, TRUE]};
Maps Pseudo-servers into real ones.
The folllowing four functions do basic set operations. Binary operators are exetended to lists by Op[LIST[s1, s2, ... sn]] = Op[...Op[s1, s2], ... sn]. The familiar definitions of these operations make use of the concept of equality. In the functions that follow, a general relation fr may be used in place of equality; when fr is defaulted to NIL it means to use equality.
Union:
PROC [fsl: FileSetList, fr: FileRelation ←
NIL]
RETURNS [fs: FileSet];
Union[LIST[A, B], fr] = A * Difference[LIST[B, A], fr ]
fr [fn', fn] = fr[fn, fn']
Intersection:
PROC [fsl: FileSetList, fr: FileRelation ←
NIL]
RETURNS [fs: FileSet];
Intersection[LIST[A, B], fr] = {fn | fn A ' fn' B fr[fn, fn']}
Difference:
PROC [fsl: FileSetList, fr: FileRelation ←
NIL]
RETURNS [fs: FileSet];
Difference[LIST[A, B], fr] = A - Intersection[LIST[A, B], fr]
SymmetricDifference:
PROC [fsl: FileSetList, fr: FileRelation ←
NIL]
RETURNS [fs: FileSet];
SymmetricDifference[LIST[A, B], fr] = Difference[LIST[A, B], fr] * Difference[LIST[B, A], fr ]
equality: FileRelation;
FileRelation: TYPE = REF FileRelationPrivate;
FileRelationPrivate:
TYPE =
RECORD [
Test: PROC [data: REF ANY, left, right: FileID] RETURNS [BOOL],
LeftToRight: PROC [data: REF ANY, fid: FileID] RETURNS [FileIDRange],
RightToLeft: PROC [data: REF ANY, fid: FileID] RETURNS [FileIDRange],
data: REF ANY ← NIL
];
FileIDRange:
TYPE =
RECORD [
lowName, highName: ROPE,
earlyCreated, lateCreated: GMT ← noGMT
];
ReverseFileRelation: PROC [fr: FileRelation] RETURNS [frr: FileRelation];
FilterFileSet: PROC [subject: FileSet, filter: Filter] RETURNS [filtered: FileSet];
FilterList: TYPE = LIST OF Filter;
Filter: TYPE = REF FilterRep;
FilterRep:
TYPE =
RECORD [
Eval: FilterEvalProc,
data: REF ANY];
FilterEvalProc: TYPE = PROC [fn: FileNote, data: REF ANY] RETURNS [BOOL];
And, Or: PROC [FilterList] RETURNS [Filter];
Not: PROC [Filter] RETURNS [Filter];
IfCreated: PROC [reln: TimeReln, when: GMT] RETURNS [Filter];
IfRead:
PROC [reln: TimeReln, when:
GMT]
RETURNS [Filter];
TimeReln: TYPE = {before, after};
NameMatches: PROC [pattern: ROPE, literal, word, ignoreCase, addBounds: BOOL ← FALSE] RETURNS [Filter];
isOnline: Filter; --consults FS
ContentsPass: PROC [filter: Filter, dfFilter: DFUtilities.Filter, allowableExceptions: NAT ← 0, ids: IdentificationScheme] RETURNS [Filter--applicable only to DF files--];
Primitive Enumerations:
FromFS: PROC [pattern: ROPE, ids: IdentificationScheme ← []] RETURNS [fs: FileSet];
EnumFSMatches:
PROC [pattern:
ROPE, to: FileConsumer, ids: IdentificationScheme ← []];
A hash sign (#) in the pattern is just like an asterisk (*), except that it won't match across directories.
FromDF: PROC [dfName: ROPE, date: DFUtilities.Date ← [], filter: DFUtilities.Filter, which: DFWhich, ids: IdentificationScheme ← []] RETURNS [fs: FileSet];
FromDFs: PROC [dfs: FileSet, filter: DFUtilities.Filter, which: DFWhich, ids: IdentificationScheme ← []] RETURNS [fs: FileSet];
EnumDF:
PROC [dfName:
ROPE, date: DFUtilities.Date ← [], to: FileConsumer, filter: DFUtilities.Filter, which: DFWhich, ids: IdentificationScheme ← []];
DFWhich: TYPE = {remote, local};
MentionedDFs: PROC [dfName: ROPE, filter: DFUtilities.Filter ← [], ids: IdentificationScheme ← []] RETURNS [fs: FileSet];
EnumMentionedDFs: PROC [dfName: ROPE, filter: DFUtilities.Filter ← [], to: FileConsumer, ids: IdentificationScheme ← []];
FromVersionMapsByShortName: PROC [vml: VersionMapList, pattern: ROPE, ids: IdentificationScheme ← []] RETURNS [fs: FileSet];
EnumVersionMapsByShortName: PROC [vml: VersionMapList, pattern: ROPE, to: FileConsumer, ids: IdentificationScheme ← []];
FromVersionMapsByCreateDate: PROC [vml: VersionMapList, range: TimeRange, ids: IdentificationScheme ← []] RETURNS [fs: FileSet];
EnumVersionMapsByCreateDate: PROC [vml: VersionMapList, range: TimeRange, to: FileConsumer, ids: IdentificationScheme ← []];
TimeRange: TYPE = RECORD [from, to: GMT--inclusive--];
FromRope: PROC [rope: ROPE, ids: IdentificationScheme ← []] RETURNS [fs: FileSet];
FromFile: PROC [fileName: ROPE, ids: IdentificationScheme ← []] RETURNS [fs: FileSet];
FromStream: PROC [from: STREAM, ids: IdentificationScheme ← []] RETURNS [fs: FileSet];
ToRope: PROC [fs: FileSet] RETURNS [ROPE];
ToFile: PROC [fs: FileSet, fileName: ROPE];
ToStream: PROC [fs: FileSet, to: IO.STREAM];
}.