UFFileManager.mesa
Created January 7, 1983
Last edit by Michael Plass on January 19, 1983 3:34 pm
DIRECTORY CIFS, Rope, UnifiedFonts;
UFFileManager: CEDAR DEFINITIONS =
BEGIN
ROPE: TYPE = Rope.ROPE;
Key: TYPE = UnifiedFonts.Key;
FontFile: TYPE = REF FontFilePermission;
FontFilePermission: TYPE;
KeyOf: PROCEDURE [fileName: ROPE] RETURNS [key: Key];
This simply looks up the file name in a table, after putting it into a canonical form.
KeyOfRefText: PROCEDURE [fileName: REF TEXT] RETURNS [key: Key];
For use where the client would rather not build a rope.
InitProc: TYPE = PROCEDURE [key: Key, fontFile: FontFile] RETURNS [REF];
Open: PROCEDURE [key: Key, initProc: InitProc ← NIL] RETURNS [fontFile: FontFile];
A FontFile is a REF that the client is supposed to hold on to for as long as it has any pointers into the file; dropping this REF is considered to be declaration that it is OK to close the file, although it typically not closed right away. The FontFile ideally should be stored together with all the pointers derived from it, so they will all go away at the same time. The initProc is called when the file is first opened, and may validate the file format and build some cached structures for later use.
GetData: PROCEDURE [fontFile: FontFile] RETURNS [REF];
Gets the data cached by the init proc.
Status: PROCEDURE [fontFile: FontFile] RETURNS [errorCode: CIFS.ErrorCode, errorMsg: Rope.ROPE, ok: BOOLEAN];
Use this to find out if the Open went well.
Pointer: UNSAFE PROCEDURE [fontFile: FontFile] RETURNS [origin: LONG POINTER];
This is how to get to the contents of the file. The pointers derived this way should be considered to be to readonly data.
These procedures are for informational purposes.
NameOf: PROCEDURE [key: Key] RETURNS [fileName: ROPE];
Just in case the client forgets the file name associated with the key.
Size: PROCEDURE [fontFile: FontFile] RETURNS [sizeInSixteenBitWords: INT];
For finding out the size of the file.
InBounds: UNSAFE PROCEDURE [fontFile: FontFile, blockAddress: LONG POINTER, sizeInWords: NAT ← 1] RETURNS [BOOLEAN];
For paraniod clients (best to be paranoid when interpreting a binary file).
These are for keeping an eye on the opening and closing activity. Only one watcher may be registered at a time.
Action: TYPE = {open, close, openFailed};
FontFileWatcher: TYPE = PROCEDURE [key: Key, action: Action];
RegisterFontFileWatcher: PROCEDURE [fontFileWatcher: FontFileWatcher];
PermissionCount: PROCEDURE RETURNS [INT];
EnumerateOpenFontFiles: PROCEDURE [visit: PROC[Rope.ROPE]];
END.