DIRECTORY
AltoFileDefs: FROM "AltoFileDefs",
DiskDefs: FROM "DiskDefs";

DiscoDefs: DEFINITIONS =
BEGIN

SFD
: TYPE = MACHINE DEPENDENT RECORD-- ScanFile descriptor
[
zone: DiskDefs.CBZptr,-- CB zone
fp: AltoFileDefs.FP,
nextCb: DiskDefs.CBptr,-- next read uses this CB ...
linkCb: DiskDefs.CBptr,-- ... and reads label into this CB
nb: CARDINAL,-- # of buffers (and CBs)
bufs: POINTER TO BUF,-- origin of buffers
head: CARDINAL,-- pn of head of queue
tail: CARDINAL,-- pn of tail of queue +1
next: CARDINAL-- next pn to read, -1 if eof
];

BUF: TYPE = MACHINE DEPENDENT RECORD -- buffer description
[
pageNumber: CARDINAL,
diskAddress: AltoFileDefs.vDA,
nchars: CARDINAL,
data: ARRAY [0..256) OF CARDINAL,
spacer: CARDINAL
];

LookupList: TYPE = RECORD
[link: POINTER TO LookupList,
fp: AltoFileDefs.FP,
name: STRING
];

DiskPosition
: TYPE = RECORD
[
VDA: AltoFileDefs.vDA,
inMemory: BOOLEAN ← FALSE,
beginByte: [0..512)
];
--low level disk routines

ReadPageFromVDA: PROCEDURE [data: POINTER,vda: AltoFileDefs.vDA];

TransferBytes: PROCEDURE [dp: POINTER TO DiskPosition,nBytes: CARDINAL,data: POINTER TO PACKED ARRAY [0..0) OF [0..377B],free: BOOLEAN ← FALSE];

IndexFile: PROCEDURE [VDA: AltoFileDefs.vDA,nVDAs: CARDINAL,vDAs: POINTER TO ARRAY [0..0) OF AltoFileDefs.vDA];

--directory search

Lookup: PUBLIC PROCEDURE [matchString: STRING] RETURNS [nameValArray: POINTER TO LookupList];

FreeLookupList: PROCEDURE [POINTER TO LookupList];
--fast streams

ScanFile: PROCEDURE [fp: POINTER TO AltoFileDefs.FP, ba: POINTER TO UNSPECIFIED, len: CARDINAL, fa: POINTER TO AltoFileDefs.FA] RETURNS [sfd: POINTER TO SFD];

ScanBuffer: PROCEDURE[sfd: POINTER TO SFD, fa: POINTER TO AltoFileDefs.FA] RETURNS [POINTER TO UNSPECIFIED];

ScanFinish: PROCEDURE [sfd: POINTER TO SFD];

END.