DIRECTORY
CrRPC USING [Handle, CreateClientHandle],
HostNickNameTable USING [LookUp],
RapunzelP2200V2,
Rope USING [ROPE],
XNS USING [BYTE, unknownSocket],
XNSAddressParsing USING [Address, AddressFromRope, MyAddress];
RapunzelSimpleClientImpl:
CEDAR
PROGRAM
IMPORTS CrRPC, HostNickNameTable, XNSAddressParsing
= BEGIN
OPEN Rapunzel: RapunzelP2200V2;
ROPE: TYPE = Rope.ROPE;
BYTE: TYPE = XNS.BYTE;
GetHandleForMe:
PROC
RETURNS [h: CrRPC.Handle] ~ {
me: XNSAddressParsing.Address = XNSAddressParsing.MyAddress[];
RETURN[CrRPC.CreateClientHandle[$SPP, me, 0]];
};
GetOtherHandle:
PROC[host:
ROPE]
RETURNS [h: CrRPC.Handle] ~ {
netAddr: ROPE = HostNickNameTable.LookUp[host];
socket: XNSAddressParsing.Address =
XNSAddressParsing.AddressFromRope[netAddr, XNS.unknownSocket];
RETURN[CrRPC.CreateClientHandle[$SPP, socket, 0]];
};
GetNet3DoradoHandle:
PROC[f:
BYTE]
RETURNS [h: CrRPC.Handle] ~ {
net3Dorado: XNSAddressParsing.Address =
[net: [a: 0, b: 0, c: 0, d: 3], host: [a: 0, b: 0, c: 170, d: 81, e: 1, f: f], socket: [a: 0, b: 0]];
RETURN[CrRPC.CreateClientHandle[$SPP, net3Dorado, 0]];
};
PeekPokePeek:
PROC[address: Rapunzel.Address, value:
CARDINAL]
RETURNS[sc: Rapunzel.SeqCmd] = TRUSTED {
peek: Rapunzel.PeekShortCmd;
poke: Rapunzel.PokeShortCmd;
sc ← NEW[Rapunzel.SeqCmdObject [3]];
peek.address ← address;
sc[0] ← sc[2] ← [peekShort[peek]];
poke.address ← address;
poke.value ← value;
sc[1] ← [pokeShort[poke]];
};
PokePoke:
PROC[address: Rapunzel.Address, value:
CARDINAL]
RETURNS[sc: Rapunzel.SeqCmd] = TRUSTED {
poke: Rapunzel.PokeShortCmd;
sc ← NEW[Rapunzel.SeqCmdObject [2]];
poke.address ← address;
poke.value ← value;
sc[0] ← [pokeShort[poke]];
poke.address ← address + 1;
poke.value ← value;
sc[1] ← [pokeShort[poke]];
};
PokePeek:
PROC[address: Rapunzel.Address, value:
CARDINAL]
RETURNS[sc: Rapunzel.SeqCmd] = TRUSTED {
peek: Rapunzel.PeekShortCmd;
poke: Rapunzel.PokeShortCmd;
sc ← NEW[Rapunzel.SeqCmdObject [2]];
peek.address ← address;
sc[1] ← [peekShort[peek]];
poke.address ← address;
poke.value ← value;
sc[0] ← [pokeShort[poke]];
};
PokePeekPeek:
PROC[addr1, addr2: Rapunzel.Address, value:
CARDINAL]
RETURNS[sc: Rapunzel.SeqCmd] = TRUSTED {
peek: Rapunzel.PeekShortCmd;
poke: Rapunzel.PokeShortCmd;
sc ← NEW[Rapunzel.SeqCmdObject [3]];
poke.address ← addr1;
poke.value ← value;
sc[0] ← [pokeShort[poke]];
peek.address ← addr1;
sc[1] ← [peekShort[peek]];
peek.address ← addr2;
sc[2] ← [peekShort[peek]];
};
PeekPoke:
PROC[address: Rapunzel.Address, value:
CARDINAL]
RETURNS[sc: Rapunzel.SeqCmd] = TRUSTED {
peek: Rapunzel.PeekShortCmd;
poke: Rapunzel.PokeShortCmd;
sc ← NEW[Rapunzel.SeqCmdObject [2]];
peek.address ← address;
sc[0] ← [peekShort[peek]];
poke.address ← address;
poke.value ← value;
sc[1] ← [pokeShort[poke]];
};
PokeSeq:
PROC[n:
CARDINAL]
RETURNS[seq: Rapunzel.SeqShort] =
{ seq ← NEW[Rapunzel.SeqShortObject [n]] };