-- file: LaurelStateDefs.mesa
-- edited by Levin: January 27, 1981 11:56 AM
-- edited by Brotz: July 15, 1980 4:20 PM
DIRECTORY
AltoDefs,
AltoFileDefs,
drD: FROM "LaurelDriverDefs",
ovD: FROM "OverviewDefs",
SegmentDefs;
lsD: DEFINITIONS =
BEGIN
--*** Public Interface ***--
-- Types --
StateSegment: TYPE = POINTER TO StateSegmentObject;
PageNumber: TYPE = CARDINAL;
PageCount: TYPE = CARDINAL;
-- Facilities to be used during installation only --
AllocateStateNode: PROCEDURE[size: CARDINAL] RETURNS [POINTER];
-- analogous to SystemDefs.AllocateHeapNode, except that it allocates a node in the permanent state heap, which is retained across sessions. Such nodes can never be deallocated.
AllocateStateString: PROCEDURE[chars: CARDINAL] RETURNS [STRING];
-- analogous to SystemDefs.AllocateHeapString.
DefineStateSegment: PROCEDURE[nPages: PageCount] RETURNS [StateSegment];
-- reserves a segment of length nPages in the file Laurel.state and returns a segment describing it, which is used in the following procedures. As with state nodes, these segments will persist across sessions. It is the client’s responsibility to ensure that the StateSegment (handle) returned is preserved as well (e.g., in another state segment, a state node, IntCommon, or DisplayCommon).
-- Facilities usable at any time --
stateFile: SegmentDefs.FileHandle;
WriteStateSegment: PROCEDURE[segment: StateSegment];
-- writes the segment to the disk.
SwapInStateSegment: PROCEDURE[segment: StateSegment] RETURNS [POINTER];
-- swaps the given segment into memory and locks it. The pointer returned is the starting address of the segment in main storage.
StateSegmentAddress: PROCEDURE[segment: StateSegment] RETURNS [POINTER];
-- The pointer returned is the starting address of the segment in main storage.
-- The segment must be swapped in and not yet released.
ReleaseStateSegment: PROCEDURE[segment: StateSegment];
-- decrements the lock count on the segment, which must be in main memory. If the lock count becomes zero, the segment may be removed from main memory.
--*** Private Interface ***--
StateHeader: PRIVATE TYPE =
MACHINE DEPENDENT RECORD[
imageFP: AltoFileDefs.FP, -- must be first
imageTime: AltoFileDefs.TIME, -- must be second
profileFP: AltoFileDefs.FP,
profileTime: AltoFileDefs.TIME,
fontsWidthsFP: AltoFileDefs.FP,
fontsWidthsTime: AltoFileDefs.TIME,
headerFF: CARDINAL,
intCOffset: CARDINAL,
disCOffset: CARDINAL,
segmentList: StateSegment,
firstSegmentPage: PageNumber,
heapSegFirstPage: PageNumber,
heapSegPages: PageCount,
heapSegDA: AltoFileDefs.vDA,
imageDATableSeg: StateSegment,
profileInUserCm: BOOLEAN,
cachedHeapTop: AltoDefs.PageNumber
];
StateSegmentObject: TYPE =
PRIVATE MACHINE DEPENDENT RECORD[
pages: PUBLIC PageCount,
link: StateSegment,
body: SELECT OVERLAID * FROM
inStateFile => [hint: AltoFileDefs.vDA],
inCore => [fsh: SegmentDefs.FileSegmentHandle],
ENDCASE
];
InstallSegments: PRIVATE PROCEDURE[header: POINTER TO StateHeader];
InitializeSegments: PRIVATE PROCEDURE[header: POINTER TO StateHeader];
CreateLaurelState: PRIVATE PROCEDURE[heapDS: SegmentDefs.DataSegmentHandle]
RETURNS [drD.InstallError];
GetWrittenTime: PRIVATE PROCEDURE [file: SegmentDefs.FileHandle]
RETURNS [time: AltoFileDefs.TIME];
END.