Hardware manual

3.5.1. Lower-level directory functions
Several functions are provided for those who wish to deal with directories and file names at a lower level.
The format of an Alto file directory is documented in the Disks documentation; definitions appear in
AltoFileSys.d.
ParseFileName(destName, srcName, list, versionControl) = stream or 0. Strips leading directory
information from srcName, puts the result in destName,
appending a "." if necessary, and returns a stream open on the
directory in which the file should be looked up. list!0 = an
errorRoutine, list!1 = a zone, list!3 = a disk which will be
passed to OpenFile along with versionControl when opening the
directory stream.
FindFdEntry(s, name, compareFn [0], dv [], hd [], versionControl [verLatest], extraSpace [0]) = a
word pointer into the stream s of a directory entry, or -1 if no
entry is located. If compareFn is 0, normal comparison of file
names and version control is performed; the result is a directory
entry in dv, and a hole descriptor (hd) for a hole large enough to
include the name, a new version number, and extraSpace words.
Otherwise, compareFn is a user procedure that is invoked as
each file name is read from the directory: compareFn(name,
nameRead, dvRead). nameRead is the Bcpl name extracted from
the directory; dvRead is the dv extracted from the directory; and
name is simply the second argument passed to FindFdEntry
(which need not be a string). If compareFn returns false, the
directory scan halts; the value of FindFdEntry is the byte
position in the stream. If compareFn returns true, the search
proceeds.
Strategic note: If compareFn is TruePredicate, the directory is
simply scanned in order to locate a hole large enough for
extraSpace words. The result is saved in the hd hole descriptor,
which may be passed to MakeNewFdEntry.
In the standard release of the operating system (version
numbering absent), the directory stream is left positioned at the
matching directory entry if one was found and at the position
described by hd otherwise.
MakeNewFdEntry(s, name, dv, hd, extraStuff) makes a directory entry: dv is a pointer to a DV
structure for the first part of the entry; name is a Bcpl string that
is recorded after the entry (this string must be a legal internal file
name, with the dot "." appended), and extraStuff is a pointer to a
vector of additional stuff that will be entered following the
name. The hd parameter is a pointer to a "hole descriptor" as
returned from FindFdEntry.
DeleteFdEntry(s, pos) Deletes the directory entry at byte location pos of the directory
open on stream s.
StripVersion(string) = version number. This function strips a version number, if
any, from the end of the string argument, and returns the
number (0 if no version specified). If, after stripping, there is no
final "." on the string, one is appended.
AppendVersion(string, version) Appends a version number and final "." to the string.
Alto Operating System May 5, 1980 11
For Xerox Internal Use Only -- December 15, 1980