IF (pgmVersion # 0)
THEN {
beginReject[h, CrRPC.noSuchVersion];
CrRPC.PutCARDINAL[h, 0]; --low
CrRPC.PutCARDINAL[h, 0]; --high
RETURN
};
SELECT proc
FROM
4 => {
-- PokeSeqShort
address: CARD;
valueSeq: RapunzelP2200V0.SeqShort;
address ← CrRPC.GetCARD[h];
{
length1: CARDINAL ~ CrRPC.GetCARDINAL[h];
valueSeq ← NEW[RapunzelP2200V0.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];
};
0 => {
-- DoCmds
cmdSeq: RapunzelP2200V0.SeqCmd;
resultSeq: RapunzelP2200V0.SeqResult;
{
length1: CARDINAL ~ CrRPC.GetCARDINAL[h];
cmdSeq ← NEW[RapunzelP2200V0.SeqCmdObject[length1]];
FOR i0:
CARDINAL
IN [0..length1)
DO
TRUSTED {
tag2: RapunzelP2200V0.OpCode ~ VAL[CrRPC.GetCARDINAL[h]];
SELECT tag2
FROM
pokeShort => {
x3: RapunzelP2200V0.PokeShortCmd;
x3.address ← CrRPC.GetCARD[h];
x3.value ← CrRPC.GetCARDINAL[h];
cmdSeq.body[i0] ← [pokeShort[x3]];
};
peekShort => {
x4: RapunzelP2200V0.PeekShortCmd;
x4.address ← CrRPC.GetCARD[h];
cmdSeq.body[i0] ← [peekShort[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: pokeShort RapunzelP2200V0.Result => {
NULL; -- RECORD []
};
it: peekShort RapunzelP2200V0.Result => {
CrRPC.PutCARDINAL[h, it.peekShort.value];
};
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: RapunzelP2200V0.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];
};