CoreIO.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Barth, May 22, 1986 3:39:20 pm PDT
Cell Type IO
UnknownProperty: SIGNAL [propKey: ATOM];
UnknownCellClass:
SIGNAL [class: Core.CellClass];
SaveCellType:
PROC [cellType: Core.CellType, fileName:
ROPE ←
NIL];
fileName=NIL => fileName ← Rope.Cat[CoreOps.GetCellTypeName[cellType], ".core"]
UnknownProperty RESUME => Property is not written.
UnknownCellClass RESUME => CoreOps.ToBasic. Recasted cell class not found => ERROR.
ReportSaveCellType:
PROC [cellType: Core.CellType, fileName:
ROPE ←
NIL]
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:
ROPE ←
NIL, fileName:
ROPE ←
NIL]
RETURNS [cellType: Core.CellType];
fileName=NIL AND cellName=NIL => ERROR
fileName=NIL => fileName ← Rope.Cat[cellName, ".core"]
Unknown properties or cell classes => ERROR
IO Registration
Class
RegisterClass:
PROC [class: Core.CellClass, write: ClassWriteProc, read: ClassReadProc, init: IOInitProc ←
NIL]
RETURNS [sameClass: Core.CellClass];
ClassWriteProc:
TYPE =
PROC [h: Handle, cellType: Core.CellType, wireIDTab: HashTable.Table, clientData:
REF
ANY ←
NIL];
ClassReadProc:
TYPE =
PROC [h: Handle, cellType: Core.CellType, wireIDTab: HashTable.Table, clientData:
REF
ANY ←
NIL];
Property
RegisterProperty:
PROC [prop:
ATOM, write: PropWriteProc, read: PropReadProc, init: IOInitProc ←
NIL]
RETURNS [sameProp:
ATOM];
PropWriteProc:
TYPE =
PROC [h: Handle, prop:
ATOM, value:
REF
ANY, clientData:
REF
ANY ←
NIL];
PropReadProc:
TYPE =
PROC [h: Handle, prop:
ATOM, clientData:
REF
ANY ←
NIL]
RETURNS [value:
REF
ANY];
General
IOInitProc:
TYPE =
PROC [h: Handle, root: Core.CellType, direction: Direction]
RETURNS [clientData:
REF
ANY];
Direction: TYPE = {Write, Read};
Handle: TYPE = REF HandleRec;
HandleRec:
TYPE =
RECORD[
stream: Core.STREAM ← NIL,
cellTypeIDTab: HashTable.Table ← NIL,
ropeIDTab: HashTable.Table ← NIL,
atomIDTab: HashTable.Table ← NIL,
clientData: SEQUENCE size: NAT OF REF ANY];
On write cellTypeIDTab maps REF to ROPE. On read cellTypeIDTab maps ROPE to REF. Similarly for rope and atom tables.
IO Utilities
WriteCellType: PROC [h: Handle, cellType: Core.CellType];
ReadCellType:
PROC [h: Handle]
RETURNS [cellType: Core.CellType];
WriteWire: PROC [h: Handle, wireIDTab: HashTable.Table, wire: Core.Wire];
ReadWire:
PROC [h: Handle, wireIDTab: HashTable.Table]
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, val: INT];
ReadInt:
PROC [h: Handle]
RETURNS [int:
INT];