BOOL, file: FileProc, import: ImportProc, error: ErrorProc, message: MessageProc ¬
EnumerateClosureInternal:
PROC [dfName:
ROPE, private:
BOOL] = {
ProcessItem: DFUtilities.ProcessItemProc = {
WITH item
SELECT
FROM
dirItem: REF DFUtilities.DirectoryItem => lastDirectory ¬ dirItem;
fileItem:
REF DFUtilities.FileItem => {
IF (alreadyFetchedPublic AND NOT lastDirectory.exported) OR lastDirectory.exported OR private THEN file[data, fileItem.name, fileItem.date, lastDirectory.path1, lastDirectory.exported];
};
importsItem:
REF DFUtilities.ImportsItem =>
SELECT import[data, importsItem.path1, importsItem.date, importsItem.exported, importsItem.form]
FROM
public => EnumerateClosureInternal[importsItem.path1, FALSE];
all => EnumerateClosureInternal[importsItem.path1, TRUE];
same => EnumerateClosureInternal[importsItem.path1, private];
none => {};
ENDCASE => ERROR;
includeItem: REF DFUtilities.IncludeItem => EnumerateClosureInternal[includeItem.path1, private];
ENDCASE => ERROR;
};
alreadyFetchedPublic: BOOL ¬ FALSE;
lastDirectory: REF DFUtilities.DirectoryItem ¬ NIL;
fullDFName: ROPE = ShortToFullMapping[shortToFull, dfName ! FS.Error => {errorMsg ¬ error.explanation; GOTO FSFailed}];
IF Member[IF private THEN fullWithAll ELSE fullWithPublic, fullDFName] THEN RETURN;
IF NOT private AND Member[fullWithAll, fullDFName] THEN RETURN;
dfFiles ¬ dfFiles + 1;
IF private
THEN fullWithAll ¬ CONS [fullDFName, fullWithAll]
ELSE fullWithPublic ¬ CONS [fullDFName, fullWithPublic];
alreadyFetchedPublic ¬ private AND Member[fullWithPublic, fullDFName];
IF message#NIL THEN message[data, Rope.Cat["Considering ", fullDFName, IF private THEN IF alreadyFetchedPublic THEN " (private)" ELSE " (all)" ELSE " (public)"]];
DFUtilities.ParseFromFile[
fullDFName, ProcessItem,
[comments: FALSE, filterA: $all, filterB: IF alreadyFetchedPublic THEN $private ELSE $all, filterC: $all, list: NIL]
! FS.Error => {errorMsg ¬ error.explanation; GOTO FSFailed};
DFUtilities.FileSyntaxError => {errorMsg ¬ reason; GOTO FileSyntaxError}];
EXITS
FSFailed => error[data, notFound, errorMsg];
FileSyntaxError => error[data, syntaxError, errorMsg];
};