-- RTTBridge.Mesa
-- last modified on September 8, 1982 11:45 am by Paul Rovner
DIRECTORY
PrincOps USING[FrameHandle, GlobalFrameHandle, BytePC],
Rope USING[ROPE],
RTBasic USING[TypedVariable, Type],
RTTypes USING[Status];
RTTBridge: DEFINITIONS
= BEGIN OPEN PrincOps, RTBasic, RTTypes;
-- Mappings between TypedVariables and REFs.
TVForReferent: PROC[ref: REF ANY, status: Status ← mutable]
RETURNS[TypedVariable];
RefFromTV: PROC[tv: TypedVariable] RETURNS[REF ANY];
-- If possible, this returns the REF which points to the value represented by the specified
-- TypedVariable. Raises InternalTV if tv is embedded, NotVar if TVStatus[tv] # mutable.
SomeRefFromTV: PROC[tv: TypedVariable] RETURNS[REF ANY];
-- Like RefFromTV, but copies instead of raising an error.
TVForReadOnlyReferent: PROC[ref: REF READONLY ANY]
RETURNS[TypedVariable];
ReadOnlyRefFromTV: PROC[tv: TypedVariable -- status: readOnly--]
RETURNS[REF READONLY ANY];
-- Mappings between TypedVariables and pointers, transfer descriptors
-- and frame handles.
TVForPointerReferent:
PROC[ptr: LONG POINTER, type: Type, status: Status ← mutable]
RETURNS[TypedVariable];
PointerFromTV: PROC[tv: TypedVariable] RETURNS[LONG POINTER];
-- If possible, this returns the LONG POINTER which points to
-- the value represented by the specified TypedVariable.
-- Raises InternalTV if tv is embedded and not word aligned
-- Raises NotVar if TVStatus[tv] # mutable.
TVForProc: PROC[proc: PROC ANY RETURNS ANY] RETURNS[TypedVariable--procedure--];
TVToProc: PROC[tv: TypedVariable--procedure, program--] RETURNS[PROC ANY RETURNS ANY];
TVForATOM: PROC[atom: ATOM] RETURNS[TypedVariable--atom--];
TVToATOM: PROC[tv: TypedVariable--atom--] RETURNS[ATOM];
TVForROPE: PROC[rope: Rope.ROPE] RETURNS[TypedVariable--rope--]; -- use TVToName to get the ROPE back
TVForSignal: PROC[signal: ERROR ANY RETURNS ANY]
RETURNS[TypedVariable--signal, error--];
TVToSignal: PROC[tv: TypedVariable] RETURNS[ERROR ANY RETURNS ANY];
TVForFHReferent: PROC[fh: FrameHandle, evalStack: WordSequence ← NIL]
RETURNS[TypedVariable];
-- all such tvs have the same (distinguished) type: fhType
FHFromTV: PROC[tv: TypedVariable] RETURNS[FrameHandle];
BytePC: PROC[tv: TypedVariable--localFrame--]
RETURNS[PrincOps.BytePC];
TVForGFHReferent: PROC[gfh: GlobalFrameHandle] RETURNS[TypedVariable];
-- all such tvs have the same (distinguished) type: gfhType
GFHFromTV: PROC[tv: TypedVariable] RETURNS[GlobalFrameHandle];
IsStarted: PROC[tv: TypedVariable--globalFrame--] RETURNS[BOOL];
IsCopied: PROC[tv: TypedVariable--globalFrame--] RETURNS[BOOL];
-- ENGINE ROOM PROPER procs. See me (Paul Rovner) if you use this stuff.
-- Mappings between TypedVariables and basic types, enumerations and
-- subranges.
TVToLC: PROC[tv: TypedVariable] RETURNS[LONG CARDINAL];
-- Raises TypeFault if the field is bigger than 32 bits, else PUNs its value
-- (right justified, zero filled) into a LONG CARDINAL.
TVToInteger: PROC[tv: TypedVariable] RETURNS[INTEGER]; -- raises RangeFault
TVToLI: PROC[tv: TypedVariable] RETURNS[LONG INTEGER];
TVToCardinal: PROC[tv: TypedVariable] RETURNS[CARDINAL];
-- raises RangeFault
TVToCharacter: PROC[tv: TypedVariable] RETURNS[CHARACTER];
-- raises RangeFault
TVToReal: PROC[tv: TypedVariable] RETURNS[REAL];
SetTVFromLC: PROC[tv: TypedVariable, lc: LONG CARDINAL];
-- Raises TypeFault if the tv type is not basic, enumeration or subrange
-- else PUNs lc into TVType[tv] and assigns it to the field specified by tv.
SetTVFromLI: PROC[tv: TypedVariable, li: LONG INTEGER];
-- For use by Wizards. BEWARE.
Loophole: PROC[tv: TypedVariable, type: Type, tag: TypedVariable ← NIL]
RETURNS[TypedVariable];
OctalRead: PROC[tv: TypedVariable, offset: INT] RETURNS[CARDINAL];
-- escape hatch. If you need this, chances are good you're doing something wrong
TVToWordSequence: PROC[tv: TypedVariable] RETURNS [s: WordSequence];
-- TVToWordSequence copies the tv
WordSequence: TYPE = REF WordSequenceRecord;
WordSequenceRecord: TYPE = RECORD [s: SEQUENCE size: NAT OF WORD];
-- escape hatch. If you need this, chances are good you're doing something wrong
TVHead: PROC[tv: TypedVariable] RETURNS[TVHeadType];
TVHeadType: TYPE = {constant, remoteConstant, reference, remoteReference,
copiedRemoteObject, pointer, remotePointer, gfh,
remoteGFH, fh, remoteFH, notTVRecord};
END.