-- Directory.mesa (last edited by: Fay on: October 12, 1980 4:19 PM) --
DIRECTORY
File USING [Capability, delete, grow, PageCount, Permissions, read, shrink, Type, write],
System USING [GreenwichMeanTime],
Volume USING [ID];
Directory: DEFINITIONS =
BEGIN
--Directory Objects and the Working Directory
Context: TYPE;
Handle: TYPE = LONG POINTER TO Context;
defaultContext: Handle = NIL;
CopyContext: PROC [context: Handle ← defaultContext] RETURNS [Handle];
ModifyContext: PROC [context: Handle ← defaultContext, pathName: LONG STRING ← NIL, sP: SearchPath ← NIL];
GetWD: PROC [context: Handle, pathName: LONG STRING];
SetDefaultContext: PROC [context: Handle ← NIL] RETURNS [oldContext: Handle];
GetDefaultContext: PROC RETURNS [context: Handle];
KillContext: PROC [context: Handle];
--Directories
CreateSubdirectory: PROC [parentPathName, subDirectory: LONG STRING];
CreateSystemDirectory: PROC [volume: Volume.ID];
DeleteSubdirectory: PROC [parentPathName, subDirectory: LONG STRING];
--File Operations
CreateFile: PROC [fileName: LONG STRING, fileType: File.Type, size: File.PageCount, context: Handle ← defaultContext] RETURNS [file: File.Capability];
InsertFile: PROC [fileName: LONG STRING, file: File.Capability, context: Handle ← defaultContext];
DeleteFile: PROC [fileName: LONG STRING, context: Handle ← defaultContext];
RemoveFile: PROC [fileName: LONG STRING, file: File.Capability, context: Handle ← defaultContext];
Rename: PROC [oldName, newName: LONG STRING, context: Handle ← defaultContext];
LimitPermissions: PROC [fileName: LONG STRING, permissions: File.Permissions, context: Handle ← defaultContext];
--Search Paths and Directory Searches
SearchPath: TYPE = LONG DESCRIPTOR FOR ARRAY OF LONG STRING;
GetSPElement: PROC [element: CARDINAL, pathName: LONG STRING, context: Handle ← defaultContext];
LookupUnlimited: PROC [fileName: LONG STRING, context: Handle ← defaultContext] RETURNS [file: File.Capability];
Lookup: PROC [fileName: LONG STRING, context: Handle ← defaultContext, permissions: File.Permissions ← File.read] RETURNS [file: File.Capability];
GetNext: PROC [pathName, currentName, nextName: LONG STRING] RETURNS [file: File.Capability];
--Special Operations (you must know what you are doing to use these!)
Insert: PRIVATE PROC [parent: File.Capability, fileName: LONG STRING, file: File.Capability] RETURNS [BOOLEAN];
Remove: PRIVATE PROC [parent: File.Capability, fileName: LONG STRING, file: File.Capability] RETURNS [BOOLEAN];
SetPermissions: PROC [fileName: LONG STRING, file: File.Capability, context: Handle ← defaultContext];
--Leader Page Operations
PropertyType: TYPE = RECORD [CARDINAL];
nullProperty: PropertyType = [LAST[CARDINAL]];
GetProperty: PROC [file: File.Capability, property: PropertyType, propertyValue: LONG DESCRIPTOR FOR ARRAY OF UNSPECIFIED];
PutProperty: PROC [file: File.Capability, property: PropertyType, propertyValue: LONG DESCRIPTOR FOR ARRAY OF UNSPECIFIED, new: BOOLEAN ← FALSE];
GetNextProperty: PROC [file: File.Capability, currentProperty: PropertyType] RETURNS [nextProperty: PropertyType];
GetProps: PROC [file: File.Capability, name: LONG STRING] RETURNS [readDate, writeDate, createDate: System.GreenwichMeanTime, byteLength: LONG CARDINAL, parent: File.Capability];
PutProps: PROC [file: File.Capability, readDate, writeDate, createDate: System.GreenwichMeanTime];
UpdateDates: PROC [file: File.Capability, permissions: File.Permissions ← ignore] RETURNS [File.Capability];
--constants
fileMaxPermissions: File.Permissions = File.read + File.write + File.grow + File.shrink + File.delete;
maxDirectoryNameLength: CARDINAL = 40;
maxPathNameLength: CARDINAL = 451;
ignore: File.Permissions = 0;
--Signals and Errors generated by the Directory interface
Error: ERROR [type: ErrorType];
ErrorType: TYPE = {directoryNeedsScavenging, directoryNotEmpty, fileAlreadyExists, fileIsSD, fileNotFound, fileNotSD, invalidContext, invalidFileName, invalidPathName, invalidProperty, invalidSearchPath, invalidVolume, notImplemented, propertyTooSmall, rootNotFound, stringTooShort, volumeNotFound};
VolumeError: ERROR [type: VolumeErrorType, volume: Volume.ID];
VolumeErrorType: TYPE = {directoryNeedsScavenging, rootNotFound, volumeNotOpen};
OutOfBounds: SIGNAL;
END.
LOG
Time: July 25, 1980 11:43 AMBy: MarzulloAction: Created file
Time: August 29, 1980 3:25 PMBy: MarzulloAction: Added: procedure UpdateDates, parameter permissions to Lookup and constant ignore.
Time: October 12, 1980 4:19 PMBy: FayAction: Merged VolumeError and VolumeErrorType from DirectoryExtras.