IF (pgmVersion # 1)
THEN {
beginReject[h, CrRPC.noSuchVersion];
CrRPC.PutCARDINAL[h, 1]; --low
CrRPC.PutCARDINAL[h, 1]; --high
RETURN
};
SELECT proc
FROM
4 => {
-- PokeSeqShort
address: CARD;
valueSeq: RapunzelP2200V1.SeqShort;
address ← CrRPC.GetCARD[h];
{
length1: CARDINAL ~ CrRPC.GetCARDINAL[h];
valueSeq ← NEW[RapunzelP2200V1.SeqShortObject[length1]];
FOR i0:
CARDINAL
IN [0..length1)
DO
valueSeq.body[i0] ← CrRPC.GetCARDINAL[h];
ENDLOOP;
};
[] ← PokeSeqShort[h, address, valueSeq];
beginReturn[h];
};
6 => {
-- PokeLong
address: CARD;
value: CARD;
address ← CrRPC.GetCARD[h];
value ← CrRPC.GetCARD[h];
[] ← PokeLong[h, address, value];
beginReturn[h];
};
7 => {
-- DoCmds
cmdSeq: RapunzelP2200V1.SeqCmd;
resultSeq: RapunzelP2200V1.SeqResult;
{
length1: CARDINAL ~ CrRPC.GetCARDINAL[h];
cmdSeq ← NEW[RapunzelP2200V1.SeqCmdObject[length1]];
FOR i0:
CARDINAL
IN [0..length1)
DO
TRUSTED {
tag2: RapunzelP2200V1.OpCode ~ VAL[CrRPC.GetCARDINAL[h]];
SELECT tag2
FROM
peekShort => {
x3: RapunzelP2200V1.PeekShortCmd;
x3.address ← CrRPC.GetCARD[h];
cmdSeq.body[i0] ← [peekShort[x3]];
};
pokeShort => {
x4: RapunzelP2200V1.PokeShortCmd;
x4.address ← CrRPC.GetCARD[h];
x4.value ← CrRPC.GetCARDINAL[h];
cmdSeq.body[i0] ← [pokeShort[x4]];
};
ENDCASE;
};
ENDLOOP;
};
[resultSeq] ← DoCmds[h, cmdSeq];
beginReturn[h];
CrRPC.PutCARDINAL[h, resultSeq.length];
FOR i0:
CARDINAL
IN [0..resultSeq.length)
DO
CrRPC.PutCARDINAL[h, ORD[resultSeq.body[i0].type]];
WITH resultSeq.body[i0]
SELECT
FROM
it: peekShort RapunzelP2200V1.Result => {
CrRPC.PutCARDINAL[h, it.peekShort.value];
};
it: pokeShort RapunzelP2200V1.Result => {
NULL; -- RECORD []
};
ENDCASE;
ENDLOOP;
};
5 => {
-- PeekLong
address: CARD;
result: CARD;
address ← CrRPC.GetCARD[h];
[result] ← PeekLong[h, address];
beginReturn[h];
CrRPC.PutCARD[h, result];
};
3 => {
-- PeekSeqShort
address: CARD;
count: CARDINAL;
resultSeq: RapunzelP2200V1.SeqShort;
address ← CrRPC.GetCARD[h];
count ← CrRPC.GetCARDINAL[h];
[resultSeq] ← PeekSeqShort[h, address, count];
beginReturn[h];
CrRPC.PutCARDINAL[h, resultSeq.length];
FOR i0:
CARDINAL
IN [0..resultSeq.length)
DO
CrRPC.PutCARDINAL[h, resultSeq.body[i0]];
ENDLOOP;
};
1 => {
-- PeekShort
address: CARD;
result: CARDINAL;
address ← CrRPC.GetCARD[h];
[result] ← PeekShort[h, address];
beginReturn[h];
CrRPC.PutCARDINAL[h, result];
};
2 => {
-- PokeShort
address: CARD;
value: CARDINAL;
address ← CrRPC.GetCARD[h];
value ← CrRPC.GetCARDINAL[h];
[] ← PokeShort[h, address, value];
beginReturn[h];
};
ENDCASE => {
beginReject[h, CrRPC.noSuchProcedure];
};