-- CDIO.mesa
-- by Christian Jacobi August 24, 1983 3:10 pm
-- last edited by Christian Jacobi December 13, 1983 4:01 pm
CDIO:
CEDAR
DEFINITIONS
IMPORTS TokenIO =
BEGIN
-- IO based on TokenIO
-- High level procedures
ReadDesign:
PROC [from:
REF←
NIL, check:
PROC [
CD.Design]
RETURNS [
BOOL] ←
NIL]
RETURNS [
CD.Design];
--from is either a IO.STREAM, a Rope.ROPE, or NIL
--check: (called if non NIL), is called after technology and design-name is initialized
-- read proceeds only if check returns TRUE
--returns NIL if design not read in successfully
--viewer is not opened
WriteDesign:
PROC [design:
CD.Design, to:
REF←
NIL, quiet:
BOOL ←
FALSE, emergency:
BOOL ←
FALSE]
RETURNS [done:
BOOL];
--to is either a IO.STREAM, a Rope.ROPE, or NIL
--if emergency, some locks are ignored, interactive input is skipped; you better
--roll back after an emergency write is done
-- The following routines serves for calls from implementations of
-- CD.InternalWriteProc's or CD.InternalReadProc';
-- they must not be called inside arbitrary computations where the appropriate
-- initializations and finalizations are not done.
DesignInReadOperation:
PROC []
RETURNS [
CD.Design] =
INLINE {
RETURN [designInReadOperation]
};
designInReadOperation: PRIVATE READONLY CD.Design;
VersionKey:
PROC []
RETURNS [
INT] =
INLINE {
-- returns version key of current read operation
RETURN [versionKey]
};
versionKey: PRIVATE READONLY INT;
ReadOrientation:
PROC []
RETURNS [orientation:
CD.Orientation] = INLINE {
i: INT = TokenIO.ReadInt[];
IF i IN [0..15] THEN orientation←i ELSE ERROR TokenIO.EncodingError;
};
WriteOrientation:
PROC [orientation:
CD.Orientation] =
INLINE {
TokenIO.WriteInt[orientation];
};
ReadLevel: PROC [] RETURNS [CD.Level];
WriteLevel: PROC [l: CD.Level];
ReadObject: PROC [] RETURNS [CD.ObPtr];
WriteObject:
PROC [ob:
CD.ObPtr];
--all its children must have been written before
ReadApplicationPtr: PROC [] RETURNS [CD.ApplicationPtr];
WriteApplicationPtr: PROC [ap: CD.ApplicationPtr];
ReadApplicationList: PROC [] RETURNS [list: CD.ApplicationList];
WriteApplicationList: PROC [list: CD.ApplicationList];
ReadProperties: PROC [] RETURNS [props: CD.Properties];
WriteProperties: PROC [props: CD.Properties];
-- Rules for IO:
-- Any Object is either bracketed with a TokenIO.PushFlag and a PopFlag, or it is represented
-- by a single INT, which references another object
-- Any Property starts with $Property followed by information bracketed with a PushFlag
-- and a PopFlag
END.