CoreClasses.mesa 
Copyright © 1985 by Xerox Corporation. All rights reserved.
Bertrand Serlet, November 12, 1985 6:01:32 pm PST
DIRECTORY Core;
CoreClasses: CEDAR DEFINITIONS = BEGIN OPEN Core;
Theory
This interface defines a set of Classes of general interest.
Record
Record describes the structuring mechanism which takes a collection of cell types of various classes and binds them together.
Some invariants must be established by a program which creates this data structure:
1) For each instance the actual field must conform to the public field of the cell type which is pointed to by the instance.
Conform[w1, w2] {
w1.structure = NIL Ò w2.elements = NIL
w1.elements ` NIL Ò
w2.elements ` NIL '
w1.elements.size = w2.elements.size '
i  [0, w1.elements.size): Conform[w1.elements[i], w2.elements[i]]
2) The wires of each actual field must point to wires that are reachable from the internal of the RecordCell.
3) The public of the CellType must point to wires that are reachable from the internal of the RecordCell.
recordCellClass: CellClass;
RecordCellType: TYPE = REF RecordCellTypeRec;
RecordCellTypeRec: TYPE = RECORD [
internal: WireSequence,
instances: CellInstanceList ← NIL];
CellInstance: TYPE = REF CellInstanceRec;
CellInstanceList: TYPE = LIST OF CellInstance;
CellInstanceRec: TYPE = RECORD [
actual: WireSequence,
type: CellType,
properties: Properties ← NIL];
instanceNameProp: ATOM; -- for naming the instance
RecordPrint: PROC [recordCellType: RecordCellType, out: STREAM];
CorrespondingActual: PROC [instance: CellInstance, public: Wire] RETURNS [actual: Wire ← NIL];
Returns the actual bound to the public in the instance, NIL if not found
Bound: PROC [instance1, instance2: CellInstance, public1, public2: Wire] RETURNS [b: BOOL];
b ← actual of instance1 corresponding to public1 = actual of instance2 corresponding to public2
internalFullName: ATOM;
Used to put full names on internal wires when CoreOps.NameAllWires is called.
Transistor
Until the next release, for simplifying the software, a transistor only have 3 wires.
transistorCellClass: CellClass;
Transistor: TYPE = REF TransistorRec;
TransistorRec: TYPE = RECORD [
type: TransistorType ← nE,
length: NAT ← 2,
width: NAT ← 4];
TransistorType: TYPE = {nE, pE, nD};
Public wires: gate, ch1, ch2.
TransistorCreate: PROC [args: TransistorRec] RETURNS [cellType: CellType];
Identity
identityCellClass: CellClass;
Identity: PROC [cellType: CellType, name: ROPE, props: Properties ← NIL] RETURNS [identity: CellType];
Returns a CellType which refers to the original CellType but has a new property list. Useful when properties describe instances of a class all of whose members have the same Core data structure.
Unspecified
Unspecified is the (structural) cell class that means to not specify structure. Cell types in this class are not necessarily leaves, nor composites --- their internal structure is unspecified.
unspecifiedCellClass: CellClass;
END.