file OSMiscOps.mesa
last modified by Satterthwaite, December 10, 1982 10:45 am
Last Edited by: Maxwell, August 2, 1983 10:18 am
DIRECTORY
BasicTime: TYPE USING [GMT],
BcdDefs: TYPE USING [VersionStamp],
FS: TYPE USING [OpenFile, nullOpenFile],
PrincOps: TYPE USING [wordsPerPage],
Rope: TYPE USING [ROPE];
OSMiscOps: DEFINITIONS = {
utilities
Address: TYPE = LONG POINTER;
pageSize: CARDINAL = PrincOps.wordsPerPage;
Pages: PROC [n: CARDINAL] RETURNS [Address];
FreePages: PROC [base: Address];
Words: PROC [nWords: CARDINAL] RETURNS [base: Address] = INLINE {
RETURN [Pages[(nWords + (pageSize-1)) / pageSize]]};
FreeWords: PROC [base: Address] = INLINE {FreePages[base]};
SignalArgs: PROC RETURNS [signal, message: UNSPECIFIED];
table bases
GetTableBase: PROC [PROGRAM] RETURNS [LONG POINTER];
functional version stamps
Stamp: TYPE [3];
MergeStamps: PROC [sum, item: Stamp] RETURNS [Stamp];
TimeToStamp: PROC [time: BcdDefs.VersionStamp] RETURNS [Stamp] = INLINE {
RETURN [LOOPHOLE[time]]};
StampToTime: PROC [s: Stamp] RETURNS [BcdDefs.VersionStamp] = INLINE {
RETURN [LOOPHOLE[s]]};
unique ids
GenerateUniqueId: PROC RETURNS [BcdDefs.VersionStamp];
BcdCreateTime: PROC RETURNS [BasicTime.GMT];
ImageId: PROC RETURNS [BcdDefs.VersionStamp];
directory interface
FileAccess: TYPE = {read, write, both};
Permissions: ARRAY FileAccess OF File.Permissions = [
read: File.read,
write: File.write+File.grow+File.shrink+File.delete,
both: File.read+File.write+File.grow+File.shrink+File.delete];
FindFile: PROC [Rope.ROPE, FileAccess←$read] RETURNS [FS.OpenFile];
RenameFile: PROC [newName, oldName: Rope.ROPE];
UnnameFile: PROC [oldName: Rope.ROPE, file: FS.OpenFile←FS.nullOpenFile];
DeleteFile: PROC [name: Rope.ROPE];
FileError: ERROR [name: Rope.ROPE];
}.