TVType: PROC[tv: TypedVariable] RETURNS[Type];
TVStatus: PROC[tv: TypedVariable] RETURNS[Status];
TVSize: PROC[tv: TypedVariable] RETURNS[words: INT];
Returns a predefined, special TV that is used to indicate the "empty" value.
GetEmptyTV: PROC RETURNS[TypedVariable];
The procedures below are applicable to all but the frame types, opaque and any.
New creates and returns a cleared object. tag has meaning only for union or sequence-containing record types. See DefaultInitialValue.
New:
PROC[
type: Type,
status: Status ← mutable,
world: WorldVM.World ← WorldVM.LocalWorld[],
tag: TV ← NIL
]
RETURNS[TypedVariable];
Copy: PROC[tv: TypedVariable] RETURNS[TypedVariable];
Assign: PROC[lhs, rhs: TypedVariable];
AssignNew: PUBLIC PROC[lhs, rhs: TypedVariable];
Two TypedVariables are Eq if assignment to one is equivalent to assignment to the other; i.e, they address the same bits. Two TypedVariables are Equal if the values have the same size and same bits. NOTE no type checking is done.
TVEq: PROC[tv1, tv2: TypedVariable] RETURNS [BOOL];
TVEqual: PROC[tv1, tv2: TypedVariable] RETURNS [BOOL];
NComponents: PROC[type: Type--record, structure--] RETURNS[Index];
VariableType:
PROC[type: Type
--record, structure--]
RETURNS[v: Type, c: Class--union, sequence, or nil--];
index range is [1..NComponents[TVType[tv]]]
IndexToTV:
PROC[tv: TypedVariable
--record, structure--, index: Index]
RETURNS[TypedVariable];
IndexToType returns the specified component of the type. SPECIAL CASE for union types: index = 0 gets you the tag type (redundant: Tag does this too).
IndexToType:
PROC[type: Type
--record, structure, union--, index: Index]
RETURNS[Type];
NameToIndex:
PROC[type: Type--record, structure, union, enumerated--, name: ROPE]
RETURNS[CARDINAL];
SPECIAL CASE for union types: index = 0 gets you the tag name
IndexToName:
PROC[type: Type--record, structure, union, enumerated--, index: CARDINAL]
RETURNS[ROPE];
applicable to enumerated, transfer, program, globalFrame, atom, rope
TVToType: PROC[tv: TypedVariable--type--] RETURNS[Type];
TVToName: PROC[tv: TypedVariable] RETURNS[ans: ROPE];
Tag: PROC[tv: TypedVariable--union--] RETURNS[TypedVariable--enumerated--];
Variant: PROC[tv: TypedVariable--union--] RETURNS[TypedVariable--record--];
IsOverlaid: PROC[type: Type--union--] RETURNS[BOOL];
record, structure, union, enumerated, sequence
IsMachineDependent: PROC[type: Type] RETURNS[BOOL];
applicable to array, sequence, procedure, signal, process, address (not atom, rope)
Domain: PROC[type: Type--array, sequence, transfer, union--] RETURNS[Type];
Range: PROC[type: Type] RETURNS[Type];
IsPacked: PROC[type: Type--array, sequence--] RETURNS[BOOL];
IsComputed: PROC[type: Type--union, sequence--] RETURNS[BOOL];
Apply:
PROC[mapper: TypedVariable
--array, sequence--, arg: TypedVariable]
RETURNS[TypedVariable];
For a rope, Length returns an INT for the number of characters in the given rope. For a sequence, Length returns an INT specifying the (max) number of elements in the sequence. Use Tag[tv] to obtain the actual sequence tag field. Their values may differ if the tag type has a non-zero lower bound.
Length: PROC[tv: TypedVariable--sequence, rope--] RETURNS[INT];
Fetch: PROC[tv: TypedVariable--rope--, index: INT] RETURNS[CHAR];
Referent:
PROC[
tv: TypedVariable--ref, list, pointer, longPointer, relativePointer--,
base: TypedVariable ← NIL--non-nil only if ref is a relativePointer. UNSAFE
]
RETURNS[TypedVariable];
ConcreteRef returns a TV for the REF <concrete referent type>. NIL -> NIL. ConcreteRef is implemented only for REFANY's that are really ATOM, LIST or ROPE guys (Error[reason: notImplemented] is raised otherwise)
ConcreteRef: PROC[tv: TypedVariable--ref any--] RETURNS[TypedVariable];
ReferentStatus: PROC[type: Type--address (not basePointer, atom)--] RETURNS[Status];
IsRefAny: PROC[type: Type--ref--] RETURNS[BOOL];
IsInterface: PROC[type: Type--record--] RETURNS[BOOL];
IsAtom: PROC[tv: TypedVariable--ref any--] RETURNS[BOOL];
IsRope: PROC[tv: TypedVariable--ref any--] RETURNS[BOOL];
IsNil: PROC[tv: TypedVariable--address--] RETURNS[BOOL];
IsOrdered: PROC[type: Type--basePointer, relativePointer--] RETURNS[BOOL];
PropertyList: PROC[tv: TypedVariable--atom--] RETURNS[TypedVariable--list, nil--];
use Coerce to Narrow or Widen
Coerce: PROC[tv: TypedVariable, targetType: Type] RETURNS[TypedVariable];
IF name exists and REFs to moduleName and/or fileName ROPEs are provided, TypeToName provides that info too.
TypeToName:
PROC[
type: Type--definition--,
moduleName: REF ROPE ← NIL,
fileName: REF ROPE ← NIL
]
RETURNS[ROPE];
peels off one layer of definition
Ground: PROC[type: Type--definition, subrange--] RETURNS[Type];
peels off all layers of definition
GroundStar: PUBLIC PROC[type: Type--definition, subrange--] RETURNS[Type];
returns first non-definition type
UnderType: PUBLIC PROC[type: Type--definition--] RETURNS[Type];
InRange: PROC[type: Type--subrange--, groundTV: TypedVariable] RETURNS[BOOL];
First: PROC[type: Type--enumerated, subrange, basic--] RETURNS[TypedVariable];
Last: PROC[type: Type--enumerated, subrange, basic--] RETURNS[TypedVariable];
Next: PROC[tv: TypedVariable--enumerated, subrange, basic--] RETURNS[TypedVariable];
NValues: PROC[type: Type--enumerated--] RETURNS[INT];
index range is [1..NValues[type]]
Value: PROC[type: Type--enumerated--, index: CARDINAL] RETURNS[TypedVariable];
StaticParent:
PROC[tv: TypedVariable
--procedure--]
RETURNS[TypedVariable--procedure--];