RoseWireTypes.Mesa
Spreitzer, September 30, 1985 9:23:26 pm PDT
Barth, September 3, 1985 4:36:21 pm PDT
DIRECTORY AMTypes, Asserting, Basics, Core, IO, PrincOps, Rope, RedBlackTree, RoseBehavior, RoseEvents, RosePrivates, VFonts;
RoseWireTypes: CEDAR DEFINITIONS =
This module defines the what Rosemary knows about Wire types.
BEGIN
LORA: TYPE = LIST OF REF ANY;
ROPE: TYPE = Rope.ROPE;
LOR: TYPE = LIST OF ROPE;
STREAM: TYPE = IO.STREAM;
TV: TYPE = AMTypes.TV;
Assertion: TYPE = Asserting.Assertion;
Assertions: TYPE = Asserting.Assertions;
SymbolTable: TYPE = RedBlackTree.Table;
WatcherList: TYPE = RoseEvents.WatcherList;
Watcher: TYPE = RoseEvents.Watcher;
Drive: TYPE = RoseBehavior.Drive;
Strength: TYPE = RoseBehavior.Strength;
PortPath: TYPE = RoseBehavior.PortPath;
Wire: TYPE = Core.Wire;
WordPtr: TYPE = LONG POINTER TO CARDINAL;
Ptr: TYPE = PrincOps.BitAddress;
nilPtr: Ptr = [word: NIL, bit: 0];
WireFlavor: TYPE = {simple, switch, drive};
WireFlavorName: ARRAY WireFlavor OF ROPE;
BehaviorClassWiring: TYPE = REF BehaviorClassWiringRep;
BehaviorClassWiringRep: TYPE = ARRAY WireFlavor OF RoseWireClass;
BehaviorTypeWiring: TYPE = REF BehaviorTypeWiringRep;
BehaviorTypeWiringRep: TYPE = ARRAY WireFlavor OF RoseWireType;
RoseWireType: TYPE = REF RoseWireTypeRec;
RoseWireTypeRec: TYPE = RECORD [
class: RoseWireClass,
typeData: REF ANY,
length: NAT,
other: Assertions ← NIL];
RoseWireClass: TYPE = REF RoseWireClassRec;
RoseWireClassRec: TYPE = RECORD [
structure: Core.WireStructure,
dereference: BOOL,
Is a value really a pointer to stuff?
addressContaining: BOOL,
For composites, are any (transitive) components represented by pointers?
Not implied by dereference.
length: INTEGERLAST[INTEGER],
= type.length when record;
meaningless when sequence or atom.
classData: REF ANYNIL,
super: RoseWireSuperClass
];
RoseWireSuperClass: TYPE = REF RoseWireSuperClassRec;
RoseWireSuperClassRec: TYPE = RECORD [
Interface
GetType: PROC [RoseWireClass, Wire] RETURNS [RoseWireType],
ListFormats: PROC [RoseWireType] RETURNS [LOR],
Don't bother to list NIL.
GetFormat: PROC [RoseWireType, ROPE] RETURNS [Format],
Given NIL, should return some vanilla default.
Structure
SelectorOffset: PROC [RoseWireType, Selector] RETURNS [dBits: NAT] ← NIL,
Offset from begin of entire value to begin of selected piece. Client must interpret the dereference field of the class before applying the offset.
FieldName: PROC [RoseWireClass, INT] RETURNS [ROPE] ← NIL,
For records.
SubType: PROC [RoseWireType, Selector] RETURNS [RoseWireType] ← NIL,
SubClass: PROC [RoseWireClass, Selector] RETURNS [RoseWireClass] ← NIL,
Representation
Bits: PROC [RoseWireType] RETURNS [INT],
No more distinction between container and interesting value; class is responsible for padding interesting part with 0's.
MesaRepresentation: PROC [RoseWireClass] RETURNS [Mesa],
the Mesa type of the representation
MesaRepAux: PROC [RoseWireClass] RETURNS [Mesa] ← NIL,
Mesa code (e.g. declaration) to establish mesa type.
NOT including the rep-auxes of sub-types.
ReferentRep: PROC [rwc: RoseWireClass, wireExpr: ROPE] RETURNS [ROPE] ← NIL,
When class.dereference.
Assuming MesaRepAux already present.
CreateReferent: PROC [RoseWireType] RETURNS [LONG POINTER] ← NIL,
When class.dereference.
Behavior
flavor: WireFlavor,
Initialize: PROC [rwt: RoseWireType, p: Ptr, steady: BOOL],
Transduce: PROC [fromS: Strength, fromT, toT: RoseWireType, fromP, toP: Ptr] ← NIL,
InitQ: PROC [rwt: RoseWireType, p: Ptr, cap: Strength] ← NIL,
Prepare to propogate Q.
InitUD: PROC [rwt: RoseWireType, p: Ptr, cap: Strength] RETURNS [isInput: BOOL] ← NIL,
Prepare to propogate U&D; report whether Q at input strength.
ComputeLevel: PROC [rwt: RoseWireType, p: Ptr, xPhobic: BOOL] RETURNS [delay: BOOL] ← NIL,
Compute level from Q, U, & D. delay => would prefer not to get current answer.
The following procedures need be implemented only by atomic wire types, and maybe soon basic sequences. Hmm... maybe they don't need to be implemented at all (here)...
CopyQ, CopyUD, CopyLevel: PROC [rwt: RoseWireType, from, to: Ptr] ← NIL,
EqualUD: PROC [rwt: RoseWireType, p1, p2: Ptr] RETURNS [equal: BOOL] ← NIL,
MaxinQ, MaxinUD: PROC [rwt: RoseWireType, from, to: Ptr] RETURNS [increase: BOOL] ← NIL
Block then Max values at from into values at to; report whether increase.
];
Mesa: TYPE = RECORD [mesa: ROPE, directory, imports: LORNIL];
Selector: TYPE = RECORD [variant: SELECT kind: * FROM
whole => [],
subscript--of sequence--, field--of record-- => [index: INT],
ENDCASE];
WireValBreak: IO.BreakProc;
IN [NUL .. SP] => sepr,
',, ':, '[, '] => break,
ENDCASE => other
Format: TYPE = REF FormatRep;
FormatRep: TYPE = RECORD [
FormatValue: PROC [RoseWireType, Format, Ptr] RETURNS [ROPE],
ParseValue: PROC [RoseWireType, Format, Ptr, STREAM] RETURNS [BOOLEAN],
MaxWidth: PROC [RoseWireType, Format, VFonts.Font] RETURNS [INT],
formatData: REF ANYNIL,
key: ROPE
];
END.