-- fortytwoClientImpl.mesa
-- Please do not edit this file.
-- It was generated using CedarRPCGen.
DIRECTORY
Rope,
SunRPC,
SunRPCAuth,
fortyone,
fourtwo,
fourtwoGetPut,
fortytwoGetPut,
fortytwo;
fortytwoClientImpl: CEDAR PROGRAM
IMPORTS SunRPC, fourtwoGetPut, fortytwoGetPut
EXPORTS fortytwo =
BEGIN
ROPE: TYPE = Rope.ROPE;
defaultTimeout: CARDINAL ← 2000;
defaultRetries: CARDINAL ← 5;
MakeFORTYTWOPROG1Client: PUBLIC PROC [h: SunRPC.Handle,
c: SunRPCAuth.Conversation] RETURNS [fortytwo.FORTYTWOPROG1] ~ {
RETURN [NEW[fortytwo.FORTYTWOPROG1Object ← [
getanswer1,
gettrueanswer1,
getbogusanswer1,
dontanswer1,
h, c, NIL]]];
};
getanswer1: PROC[o: fortytwo.FORTYTWOPROG1,
theQuestion: ROPE,
aRandomNumber: CARD16,
anotherQuestion: REF TEXT]
RETURNS [res: fourtwo.answerRec] = {
SunRPC.StartCall[o.rpcHandle, o.rpcConversation,
fortytwo.FORTYTWOPROG, 1, 1];
SunRPC.PutRope[o.rpcHandle, theQuestion];
SunRPC.PutCard32[o.rpcHandle, aRandomNumber];
SunRPC.PutRefText[o.rpcHandle, anotherQuestion];
[] ← SunRPC.SendCallAndReceiveReply[o.rpcHandle, defaultTimeout, defaultRetries];
res ← fourtwoGetPut.GetanswerRec[o.rpcHandle];
SunRPC.ReleaseReply[o.rpcHandle];
};
gettrueanswer1: PROC[o: fortytwo.FORTYTWOPROG1,
questionType: fortytwo.QuestionType,
randomNumbers: fortytwo.SeqType0]
RETURNS [res: fortytwo.trueAnswerRec] = {
SunRPC.StartCall[o.rpcHandle, o.rpcConversation,
fortytwo.FORTYTWOPROG, 1, 2];
fortytwoGetPut.PutQuestionType[o.rpcHandle, questionType];
SunRPC.PutInt32[o.rpcHandle, randomNumbers.size];
FOR i: INT IN [0..randomNumbers.size) DO
SunRPC.PutInt32[o.rpcHandle, randomNumbers[i]];
ENDLOOP;
[] ← SunRPC.SendCallAndReceiveReply[o.rpcHandle, defaultTimeout, defaultRetries];
res ← fortytwoGetPut.GettrueAnswerRec[o.rpcHandle];
SunRPC.ReleaseReply[o.rpcHandle];
};
getbogusanswer1: PROC[o: fortytwo.FORTYTWOPROG1]
RETURNS [res: INT32] = {
SunRPC.StartCall[o.rpcHandle, o.rpcConversation,
fortytwo.FORTYTWOPROG, 1, 3];
[] ← SunRPC.SendCallAndReceiveReply[o.rpcHandle, defaultTimeout, defaultRetries];
res ← SunRPC.GetInt32[o.rpcHandle];
SunRPC.ReleaseReply[o.rpcHandle];
};
dontanswer1: PROC[o: fortytwo.FORTYTWOPROG1, in: INT32] = {
SunRPC.StartCall[o.rpcHandle, o.rpcConversation,
fortytwo.FORTYTWOPROG, 1, 4];
SunRPC.PutInt32[o.rpcHandle,in];
[] ← SunRPC.SendCallAndReceiveReply[o.rpcHandle, defaultTimeout, defaultRetries];
SunRPC.ReleaseReply[o.rpcHandle];
};
MakeFORTYTWOPROG2Client: PUBLIC PROC [h: SunRPC.Handle,
c: SunRPCAuth.Conversation] RETURNS [fortytwo.FORTYTWOPROG2] ~ {
RETURN [NEW[fortytwo.FORTYTWOPROG2Object ← [
gettheanswer2,
h, c, NIL]]];
};
gettheanswer2: PROC[o: fortytwo.FORTYTWOPROG2,
questionType: fortytwo.QuestionType,
randomNumbers: fortytwo.SeqType0]
RETURNS [res: fortytwo.AnswerRec] = {
SunRPC.StartCall[o.rpcHandle, o.rpcConversation,
fortytwo.FORTYTWOPROG, 2, 1];
fortytwoGetPut.PutQuestionType[o.rpcHandle, questionType];
SunRPC.PutInt32[o.rpcHandle, randomNumbers.size];
FOR i: INT IN [0..randomNumbers.size) DO
SunRPC.PutInt32[o.rpcHandle, randomNumbers[i]];
ENDLOOP;
[] ← SunRPC.SendCallAndReceiveReply[o.rpcHandle, defaultTimeout, defaultRetries];
res ← fortytwoGetPut.GetAnswerRec[o.rpcHandle];
SunRPC.ReleaseReply[o.rpcHandle];
};
MakeTESTTYPESPROG3Client: PUBLIC PROC [h: SunRPC.Handle,
c: SunRPCAuth.Conversation] RETURNS [fortytwo.TESTTYPESPROG3] ~ {
RETURN [NEW[fortytwo.TESTTYPESPROG3Object ← [
dotest3,
h, c, NIL]]];
};
dotest3: PROC[o: fortytwo.TESTTYPESPROG3,
a: REAL,
b: DREAL,
c: BYTE,
d: INT16,
e: INT32,
f: INT32,
g: BYTE,
h: CARD16,
i: CARD32,
j: CARD32,
k: fortytwo.SeqType2,
l: PACKED ARRAY [0..3) OF BYTE,
m: fortytwo.SeqType3]
RETURNS [res: fortytwo.randomTypes] = {
SunRPC.StartCall[o.rpcHandle, o.rpcConversation,
fortytwo.TESTTYPESPROG, 3, 13];
SunRPC.PutReal[o.rpcHandle, a];
SunRPC.PutDReal[o.rpcHandle, b];
SunRPC.PutInt32[o.rpcHandle, c];
SunRPC.PutInt32[o.rpcHandle, d];
SunRPC.PutInt32[o.rpcHandle, e];
SunRPC.PutInt32[o.rpcHandle, f];
SunRPC.PutInt32[o.rpcHandle, g];
SunRPC.PutCard32[o.rpcHandle, h];
SunRPC.PutCard32[o.rpcHandle, i];
SunRPC.PutCard32[o.rpcHandle, j];
SunRPC.PutInt32[o.rpcHandle, k.size];
FOR i: INT IN [0..k.size) DO
fortytwoGetPut.Puttuple[o.rpcHandle, k[i]];
ENDLOOP;
FOR i: INT IN [0..3) DO
SunRPC.PutByte[o.rpcHandle, l[i]];
ENDLOOP;
SunRPC.PutAlign[o.rpcHandle];
SunRPC.PutInt32[o.rpcHandle, m.size];
FOR i: INT IN [0..m.size) DO
SunRPC.PutInt32[o.rpcHandle, m[i]];
ENDLOOP;
[] ← SunRPC.SendCallAndReceiveReply[o.rpcHandle, defaultTimeout, defaultRetries];
res ← fortytwoGetPut.GetrandomTypes[o.rpcHandle];
SunRPC.ReleaseReply[o.rpcHandle];
};
END.