-- RTTypesRemotePrivate.Mesa
-- last modified on December 21, 1982 9:20 am by Paul Rovner

DIRECTORY
AMBridge USING[WordSequence, RemotePD, RemoteGlobalFrameHandle, RemoteFrameHandle,
RemoteRef, RemoteSED, RemotePointer],
BcdOps USING[BcdBase],
PilotLoadStateFormat USING[ModuleInfo],
PrincOps USING[GFTIndex, GlobalFrame, Frame, SignalDesc, EPRange, BytePC],
Rope USING[ROPE],
RTBasic USING[TypedVariable, Type],
RTCommon USING[Field],
RTSymbols USING[SymbolTableBase, BodyIndex, CallableBodyIndex],
WorldVM USING[World];

RTTypesRemotePrivate: DEFINITIONS
= BEGIN OPEN AMBridge, RTBasic, RTSymbols, WorldVM;

-- S I G N A L S

RemoteError: ERROR[type: RemoteErrorType, message: LONG POINTER TO TEXTNIL];
RemoteErrorType: TYPE = {addressFault, invalidFrame};


-- T Y P E S

EVRange: TYPE = [0..4*PrincOps.EPRange);

-- P R O C E D U R E S

-- This really ought to be in AMBridge.
RemoteTypeToLocal
: PROC[world: World, remoteType: CARDINAL] RETURNS[type: Type];

UnwindRemoteIndirectProcDesc: PROC[pd: RemotePD] RETURNS[RemotePD];

AcquireCBTHandleFromRemotePD: PROC[pd: RemotePD]
RETURNS[stb: SymbolTableBase, cbti: CallableBodyIndex];

AcquireSTBFromRemoteGFH: PROC[gfh: RemoteGlobalFrameHandle]
RETURNS[stb: SymbolTableBase];

GetRemoteGFHandle: PROC[world: World, gfi: PrincOps.GFTIndex]
RETURNS[RemoteGlobalFrameHandle];

GetRemoteGFHeader: PROC[gfh: RemoteGlobalFrameHandle] RETURNS[REF PrincOps.GlobalFrame];

GetRemoteFrameHeader: PROC[fh: RemoteFrameHandle] RETURNS[REF PrincOps.Frame];

GetRemoteWords: PROC[remotePointer: RemotePointer, nWords: NAT]
RETURNS[AMBridge.WordSequence];

GetRemoteWord: PROC[remotePointer: RemotePointer] RETURNS[WORD];

GetRemoteLC: PROC[remotePointer: RemotePointer] RETURNS[LONG CARDINAL];

RemoteStoreWords: PROC[from: LONG POINTER, to: RemotePointer, nWords: NAT];

RemoteStoreWord: PROC[to: RemotePointer, value: CARDINAL];

RemoteStoreDoubleWord: PROC[to: RemotePointer, value: LONG CARDINAL];

RemoteStoreFieldLong: PROC[ptr: RemotePointer,
field: RTCommon.Field,
value: LONG CARDINAL];

ValidateRemoteFrame: PROC[remoteFH: RemoteFrameHandle];

GetRemoteReferentType: PROC[remoteRef: RemoteRef]
RETURNS[Type--valid locally--];

GetRemoteProcedureType: PROC[remotePD: RemotePD]
RETURNS[Type--valid locally--];

GetRemoteSignalType: PROC[remoteSED: RemoteSED]
RETURNS[Type--valid locally--];

IsRemoteCatchFrame: PROC[remoteFrameHandle: RemoteFrameHandle, bti: BodyIndex]
RETURNS [isCatchFrame: BOOLEANTRUE,
revBti: BodyIndex];

AcquireBTIFromRemoteFH: PROC[remoteFrameHandle: RemoteFrameHandle, contextPC: BOOL]
RETURNS[bti: BodyIndex];

RemotePDToName: PROC[pd: RemotePD] RETURNS[Rope.ROPE];

RemoteSEDToName: PROC[sed: RemoteSED] RETURNS[Rope.ROPE];

RemoteGFHToName: PROC[gfh: RemoteGlobalFrameHandle,
moduleNameOnly: BOOLFALSE]
RETURNS[Rope.ROPE];

ValidateRemoteRef: PROC [ref: RemoteRef];
-- raises InvalidRef if ref does not point to the top of a valid object,
-- else returns.

RemoteSignalValues: PROC[tv: TypedVariable--catch Frame--]
RETURNS [message: CARDINAL, signal: PrincOps.SignalDesc, world: World];

AcquireRemoteBCDAndModule: PROC[gfh: RemoteGlobalFrameHandle]
RETURNS[BcdOps.BcdBase, PilotLoadStateFormat.ModuleInfo];

AcquireRemoteBCD: PROC[world: World, bcd: BcdOps.BcdBase--remote--]
RETURNS[mappedBCD: BcdOps.BcdBase--local--];

ReleaseRemoteBCD: PROC[bcd: BcdOps.BcdBase];

GetRemoteEp
: PROC[pc: PrincOps.BytePC,
gf: RemoteGlobalFrameHandle,
stb: SymbolTableBase]
RETURNS[ep: EVRange, start: PrincOps.BytePC];

GetRemotePc: PROC[gf: RemoteGlobalFrameHandle, i: EVRange] RETURNS [PrincOps.BytePC];

END
.