DIRECTORY Core, CoreClasses, CoreDirectory, RefTab; CoreIO: CEDAR DEFINITIONS = BEGIN ROPE: TYPE = Core.ROPE; UnknownProperty: SIGNAL [propKey: ATOM]; UnknownCellClass: SIGNAL [class: Core.CellClass]; SaveCellType: PROC [cellType: Core.CellType, fileName: ROPE _ NIL]; ReportSaveCellType: PROC [cellType: Core.CellType, fileName: ROPE _ NIL] RETURNS [props: LIST OF ATOM, classes: LIST OF Core.CellClass]; RestoreCellType: PROC [cellName: ROPE _ NIL, fileName: ROPE _ NIL] RETURNS [cellType: Core.CellType]; SaveLibrary: PROC [library: CoreDirectory.Library, fileName: ROPE]; RestoreLibrary: PROC [fileName: ROPE] RETURNS [library: CoreDirectory.Library]; RegisterClass: PROC [class: Core.CellClass, write: ClassWriteProc, read: ClassReadProc] RETURNS [sameClass: Core.CellClass]; ClassWriteProc: TYPE = PROC [h: Handle, cellType: Core.CellType, wireIDTab: RefTab.Ref]; ClassReadProc: TYPE = PROC [h: Handle, cellType: Core.CellType, wireIDTab: RefTab.Ref]; RegisterProperty: PROC [prop: ATOM, write: PropWriteProc, read: PropReadProc] RETURNS [sameProp: ATOM]; PropWriteProc: TYPE = PROC [h: Handle, prop: ATOM, value: REF ANY]; PropReadProc: TYPE = PROC [h: Handle, prop: ATOM] RETURNS [value: REF ANY]; Handle: TYPE = REF HandleRec; HandleRec: TYPE = RECORD[ cellType: Core.CellType _ NIL, -- current cell type wire: Core.Wire _ NIL, -- current wire, NIL if none fileName: Core.ROPE _ NIL, stream: Core.STREAM _ NIL, cellTypeIDTab: RefTab.Ref _ NIL, ropeIDTab: RefTab.Ref _ NIL, atomIDTab: RefTab.Ref _ NIL, wireIDTab: RefTab.Ref _ NIL, properties: Core.Properties _ NIL]; WriteCellType: PROC [h: Handle, cellType: Core.CellType]; ReadCellType: PROC [h: Handle] RETURNS [cellType: Core.CellType]; WriteWire: PROC [h: Handle, wireIDTab: RefTab.Ref, wire: Core.Wire]; ReadWire: PROC [h: Handle, wireIDTab: RefTab.Ref] RETURNS [wire: Core.Wire]; WriteProperties: PROC [h: Handle, properties: Core.Properties]; ReadProperties: PROC [h: Handle] RETURNS [properties: Core.Properties _ NIL]; WriteID: PROC [h: Handle, id: ROPE]; ReadID: PROC [h: Handle] RETURNS [id: ROPE]; WriteAtom: PROC [h: Handle, atom: ATOM]; ReadAtom: PROC [h: Handle] RETURNS [atom: ATOM]; WriteRope: PROC [h: Handle, rope: ROPE]; ReadRope: PROC [h: Handle] RETURNS [rope: ROPE]; WriteListOfRope: PROC [h: Handle, ropes: LIST OF ROPE]; ReadListOfRope: PROC [h: Handle] RETURNS [ropes: LIST OF ROPE]; WriteInt: PROC [h: Handle, int: INT]; ReadInt: PROC [h: Handle] RETURNS [int: INT]; WriteReal: PROC [h: Handle, real: REAL]; ReadReal: PROC [h: Handle] RETURNS [real: REAL]; WriteBool: PROC [h: Handle, bool: BOOL]; ReadBool: PROC [h: Handle] RETURNS [bool: BOOL]; WriteHashTable: PROC [h: Handle, table: RefTab.Ref, eachPair: HashWriteProc]; HashWriteProc: TYPE = PROC [h: Handle, key: RefTab.Key, value: RefTab.Val]; ReadHashTable: PROC [h: Handle, eachPair: HashReadProc, equal: RefTab.EqualProc _ NIL, hash: RefTab.HashProc _ NIL] RETURNS [table: RefTab.Ref]; HashReadProc: TYPE = PROC [h: Handle] RETURNS [key: RefTab.Key, value: RefTab.Val]; WriteCellTypeIDPair: HashWriteProc; ReadCellTypeIDPair: HashReadProc; WriteRopeIDPair: HashWriteProc; ReadRopeIDPair: HashReadProc; WriteAtomIDPair: HashWriteProc; ReadAtomIDPair: HashReadProc; END. าCoreIO.mesa Copyright ำ 1985, 1987 by Xerox Corporation. All rights reserved. Barth, December 4, 1986 4:59:34 pm PST Bertrand Serlet June 4, 1987 2:30:01 pm PDT Mike Spreitzer February 27, 1987 2:43:27 pm PST Theory Do not put source information in .core or .corelib files! They are caches which may be flushed at any time! CoreIO is just a speed up for saving the result of some computation and reading it later without paying all of the cost of the computation again. Cell Type IO fileName=NIL => fileName _ Rope.Cat[CoreOps.GetCellTypeName[cellType], ".core"] UnknownProperty RESUME => Property is not written. UnknownCellClass RESUME => CoreOps.Recast. No recast proc => ERROR. Same as SaveCellType but catches unknown signals and returns a list of them when finished. fileName=NIL AND cellName=NIL => ERROR fileName=NIL => fileName _ Rope.Cat[cellName, ".core"] Unknown properties or cell classes => ERROR Always returns an imports Library IO .corelib is added to fileName .corelib is added to fileName Unknown properties or cell classes => ERROR IO Registration Class Property General On write cellTypeIDTab maps REF to ROPE. On read cellTypeIDTab maps ROPE to REF. Similarly for rope and atom tables. IO Utilities ส%˜codešœ ™ KšœB™BK™&K™+K™/—K™šฯk œ*˜3K˜—Kšฯnœœ œ˜!K˜Kšœœœ˜head™Ibodyšฯbl™lMšœ‘™‘—™ K˜Kšžœœ œ˜(šžœœ˜1K™—šž œœ%œœ˜CKšœO™OKšœœ™2Kšœœ'™DK˜—šžœœ%œœœ œœœ œœ˜ˆJšœZ™ZK˜—šžœœ œœ œœœ˜eKšœ œœ œ™&Kšœ6™6Kšœ&™+K™——™ šž œœ,œ˜CKšœ™K˜—šžœœ œœ"˜OKšœ™Kšœ&™+——™™šž œœEœ˜|K˜—šœœœ=˜XK˜—šœœœ=˜WK˜——™š žœœœ,œ œ˜gK˜—š œœœœ œœ˜CK˜—š œœœœœ œœ˜KK˜——™Kšœœœ ˜šœ œœ˜Kšœœฯc˜4Kšœœ ˜4Kšœœœ˜Kšœ œœ˜Kšœœ˜ Kšœœ˜Kšœœ˜Kšœœ˜Kšœœ˜#Kšœv™v———™ Kšž œœ&˜9šž œœ œ˜AK˜—Kšž œœ5˜Dšžœœ$œ˜LK˜—Kšžœœ*˜?šžœœ œ œ˜MK˜—Kšžœœœ˜$šžœœ œœ˜,K˜—Kšž œœœ˜(šžœœ œœ˜0K˜—Kšž œœœ˜(šžœœ œœ˜0K˜—Kšžœœ œ˜7šžœœ œ  œ˜?K˜—Kšžœœœ˜%šžœœ œœ˜-K˜—Kšž œœœ˜(šžœœ œœ˜0K˜—Kšž œœœ˜(šžœœ œœ˜0K˜—šžœœ9˜MKšœœœ1˜K—š ž œœ?œœœ˜Kšœœœ œ&˜SK˜Kšžœ˜#šžœ˜!K˜—Kšžœ˜šžœ˜K˜—Kšžœ˜šžœ˜K˜———Kšœ˜—…— ฎฅ