RapunzelSimpleClientImpl.Mesa
Copyright (C) 1986 by Xerox Corporation. All rights reserved.
taken from RapunzelP1620V0ClientImpl.mesa
Willie-Sue, October 9, 1986 5:28:49 pm PDT
DIRECTORY
CrRPC USING [Handle, CreateClientHandle],
HostNickNameTable USING [LookUp],
RapunzelP2200V1,
Rope USING [ROPE],
XNS USING [BYTE, unknownSocket],
XNSName USING [Address, AddressFromRope, MyAddress];
RapunzelSimpleClientImpl:
CEDAR
PROGRAM
IMPORTS CrRPC, HostNickNameTable, Rapunzel: RapunzelP2200V1, XNSName
= BEGIN
ROPE: TYPE = Rope.ROPE;
BYTE: TYPE = XNS.BYTE;
GetHandleForMe:
PROC
RETURNS [h: CrRPC.Handle] ~ {
me: XNSName.Address = XNSName.MyAddress[];
RETURN[CrRPC.CreateClientHandle[$SPP, me, 0]];
};
GetOtherHandle:
PROC[host:
ROPE]
RETURNS [h: CrRPC.Handle] ~ {
netAddr: ROPE = HostNickNameTable.LookUp[host];
socket: XNSName.Address = XNSName.AddressFromRope[netAddr, XNS.unknownSocket];
RETURN[CrRPC.CreateClientHandle[$SPP, socket, 0]];
};
GetNet3DoradoHandle:
PROC[f:
BYTE]
RETURNS [h: CrRPC.Handle] ~ {
net3Dorado: XNSName.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]];
};
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]] };