CoreIO.mesa
Copyright Ó 1985, 1987, 1988 by Xerox Corporation. All rights reserved.
Barth, December 4, 1986 4:59:34 pm PST
Bertrand Serlet May 5, 1988 3:14:33 pm PDT
Mike Spreitzer February 27, 1987 2:43:27 pm PST
DIRECTORY
Core, CoreClasses, CoreDirectory,
IO, RefTab;
CoreIO: CEDAR DEFINITIONS = BEGIN
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
UnknownProperty: SIGNAL [propKey: ATOM];
UnknownCellClass: SIGNAL [class: Core.CellClass];
SaveCellType: PROC [cellType: Core.CellType, fileName: Core.ROPENIL];
fileName=NIL => fileName ← Rope.Cat[CoreOps.GetCellTypeName[cellType], ".core"]
UnknownProperty RESUME => Property is not written.
UnknownCellClass RESUME => CoreOps.Recast. No recast proc => ERROR.
ReportSaveCellType: PROC [cellType: Core.CellType, fileName: Core.ROPENIL] RETURNS [props: LIST OF ATOM, classes: LIST OF Core.CellClass];
Same as SaveCellType but catches unknown signals and returns a list of them when finished.
RestoreCellType: PROC [cellName: Core.ROPENIL, fileName: Core.ROPENIL] RETURNS [cellType: Core.CellType];
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
SaveLibrary: PROC [library: CoreDirectory.Library, fileName: Core.ROPE];
.corelib is added to fileName
RestoreLibrary: PROC [fileName: Core.ROPE] RETURNS [library: CoreDirectory.Library];
.corelib is added to fileName
Unknown properties or cell classes => ERROR
Class Registration
RegisterClass: PROC [class: Core.CellClass, write: ClassWriteProc, read: ClassReadProc] RETURNS [sameClass: Core.CellClass];
ClassWriteProc: TYPE = PROC [stream: IO.STREAM, cellType: Core.CellType, wireIDTable: RefTab.Ref];
ClassReadProc: TYPE = PROC [stream: IO.STREAM, cellType: Core.CellType, wireIDTable: RefTab.Ref];
Property Registration
RegisterProperty: PROC [prop: ATOM, write: PropWriteProc, read: PropReadProc] RETURNS [sameProp: ATOM];
PropWriteProc: TYPE = PROC [stream: IO.STREAM, prop: ATOM, value: REF ANY];
PropReadProc: TYPE = PROC [stream: IO.STREAM, prop: ATOM] RETURNS [value: REF ANY];
IO Utilities
WriteCellType: PROC [stream: IO.STREAM, cellType: Core.CellType];
ReadCellType: PROC [stream: IO.STREAM] RETURNS [cellType: Core.CellType];
WriteWire: PROC [stream: IO.STREAM, wireIDTable: RefTab.Ref, wire: Core.Wire];
ReadWire: PROC [stream: IO.STREAM, wireIDTable: RefTab.Ref] RETURNS [wire: Core.Wire];
WriteProperties: PROC [stream: IO.STREAM, properties: Core.Properties];
ReadProperties: PROC [stream: IO.STREAM] RETURNS [properties: Core.Properties ← NIL];
END.