CDIO.mesa
Copyright © 1983, 1985 by Xerox Corporation. All rights reserved.
by Christian Jacobi, August 24, 1983 3:10 pm
last edited by Christian Jacobi, April 11, 1985 2:39:27 pm PST
DIRECTORY
CD, Rope, TokenIO;
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
-- Working directories and filenames ~~~~~~~~~~~~~~~~~~~~~~~
SetWorkingDirectory:
PROC [design:
REF, wDir: Rope.
ROPE];
--design: Design, Technology or global; does not overwrite value given by user profile
GetWorkingDirectory:
PROC [design:
REF←NIL]
RETURNS [wDir: Rope.
ROPE];
--design: Design, Technology or global
UseWorkingDirectory:
PROC [design:
REF←NIL]
RETURNS [wDir: Rope.
ROPE];
--set (and returns) working directory for the running process
--design: Design, Technology or global
MakeName:
PROC [base: Rope.
ROPE, ext: Rope.
ROPE←
NIL, wDir: Rope.
ROPE←
NIL, modifier: Rope.
ROPE←
NIL]
RETURNS [Rope.
ROPE];
--makes a filename: adds extension ext if base does not have an extension;
--adds working directory wDir if base is not a full path name
--adds modifier if not NIL
MakeShortName:
PROC [design:
CD.Design]
RETURNS [name: Rope.
ROPE];
--tries to guess a good base part of filename for the design
-- Object implementors ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- 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];
WriteOrientation:
PROC [orientation:
CD.Orientation] =
INLINE {
TokenIO.WriteInt[orientation];
};
ReadLayer: PROC [] RETURNS [CD.Layer];
WriteLayer: PROC [l: CD.Layer];
ReadObject: PROC [] RETURNS [CD.Object];
WriteObject:
PROC [ob:
CD.Object];
--all its children must have been written before
ReadInstance: PROC [] RETURNS [CD.Instance];
WriteInstance: PROC [ap: CD.Instance];
ReadInstanceList: PROC [] RETURNS [list: CD.InstanceList];
WriteInstanceList: PROC [list: CD.InstanceList];
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.