<> <> <> <> 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.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.