-- fortytwoServerImpl.mesa -- Please do not edit this file. -- It was generated using CedarRPCGen. DIRECTORY SunRPC, SunRPCAuth, Rope, fortyone, fourtwo, fourtwoGetPut, fortytwoGetPut, fortytwo; fortytwoServerImpl: CEDAR PROGRAM IMPORTS Rope, SunRPC, fourtwoGetPut, fortytwoGetPut EXPORTS fortytwo = BEGIN ROPE: TYPE = Rope.ROPE; Handle: TYPE = SunRPC.Handle; Conversation: TYPE = SunRPCAuth.Conversation; defaultReplyTTL: CARDINAL _ 10; MakeFORTYTWOPROG1Server: PUBLIC PROC[ data: REF, getanswer: fortytwo.getanswerProc, gettrueanswer: fortytwo.gettrueanswerProc, getbogusanswer: fortytwo.getbogusanswerProc, dontanswer: fortytwo.dontanswerProc ] RETURNS [SunRPC.Server] ~ { pseudoClient: fortytwo.FORTYTWOPROG1 ~ NEW[fortytwo.FORTYTWOPROG1Object _ [ rpcHandle ~ NIL, rpcConversation ~ NIL, data ~ data, getanswer ~ getanswer, gettrueanswer ~ gettrueanswer, getbogusanswer ~ getbogusanswer, dontanswer ~ dontanswer ]]; unbound: SunRPC.Server ~ NEW[SunRPC.ServerObject _ [ pgm ~ fortytwo.FORTYTWOPROG, version ~ fortytwo.FORTYTWOVERS1, clientData ~ pseudoClient, serverProc ~ FORTYTWOPROG1Handler ]]; RETURN [unbound]; }; FORTYTWOPROG1Handler: SunRPC.ServerProc -- [h: Handle, c: Conversation, proc: CARD, clientData: REFANY -- RETURNS [doReply: BOOLEAN, replyTimeToLive: CARDINAL] -- = { o: fortytwo.FORTYTWOPROG1 _ NARROW[clientData]; doReply _ TRUE; replyTimeToLive _ defaultReplyTTL; SELECT proc FROM 1 => getanswer1[h, c, o]; 2 => gettrueanswer1[h, c, o]; 3 => getbogusanswer1[h, c, o]; 4 => dontanswer1[h, c, o]; ENDCASE => ERROR SunRPC.Error[$wrongProc]; }; getanswer1: PROC[h: Handle, c: Conversation, o: fortytwo.FORTYTWOPROG1] = { theQuestion: ROPE; aRandomNumber: CARD16; anotherQuestion: REF TEXT; out: fourtwo.answerRec; theQuestion _ SunRPC.GetRope[h]; aRandomNumber _ SunRPC.GetCard32[h]; anotherQuestion _ SunRPC.GetRefText[h]; out _ o.getanswer[o, theQuestion, aRandomNumber, anotherQuestion]; SunRPC.StartReply[h]; fourtwoGetPut.PutanswerRec[h, out]; }; gettrueanswer1: PROC[h: Handle, c: Conversation, o: fortytwo.FORTYTWOPROG1] = { questionType: fortytwo.QuestionType; randomNumbers: fortytwo.SeqType0; out: fortytwo.trueAnswerRec; questionType _ fortytwoGetPut.GetQuestionType[h]; { len: INT _ SunRPC.GetInt32[h]; randomNumbers _ NEW[fortytwo.SeqType0Object[len]]; FOR i: INT IN [0..len) DO randomNumbers[i] _ SunRPC.GetInt32[h]; ENDLOOP; }; out _ o.gettrueanswer[o, questionType, randomNumbers]; SunRPC.StartReply[h]; fortytwoGetPut.PuttrueAnswerRec[h, out]; }; getbogusanswer1: PROC[h: Handle, c: Conversation, o: fortytwo.FORTYTWOPROG1] = { out: INT32; out _ o.getbogusanswer[o]; SunRPC.StartReply[h]; SunRPC.PutInt32[h, out]; }; dontanswer1: PROC[h: Handle, c: Conversation, o: fortytwo.FORTYTWOPROG1] = { in: INT32; in _ SunRPC.GetInt32[h]; o.dontanswer[o, in]; SunRPC.StartReply[h]; }; MakeFORTYTWOPROG2Server: PUBLIC PROC[ data: REF, gettheanswer: fortytwo.gettheanswerProc ] RETURNS [SunRPC.Server] ~ { pseudoClient: fortytwo.FORTYTWOPROG2 ~ NEW[fortytwo.FORTYTWOPROG2Object _ [ rpcHandle ~ NIL, rpcConversation ~ NIL, data ~ data, gettheanswer ~ gettheanswer ]]; unbound: SunRPC.Server ~ NEW[SunRPC.ServerObject _ [ pgm ~ fortytwo.FORTYTWOPROG, version ~ fortytwo.FORTYTWOVERS2, clientData ~ pseudoClient, serverProc ~ FORTYTWOPROG2Handler ]]; RETURN [unbound]; }; FORTYTWOPROG2Handler: SunRPC.ServerProc -- [h: Handle, c: Conversation, proc: CARD, clientData: REFANY -- RETURNS [doReply: BOOLEAN, replyTimeToLive: CARDINAL] -- = { o: fortytwo.FORTYTWOPROG2 _ NARROW[clientData]; doReply _ TRUE; replyTimeToLive _ defaultReplyTTL; SELECT proc FROM 1 => gettheanswer2[h, c, o]; ENDCASE => ERROR SunRPC.Error[$wrongProc]; }; gettheanswer2: PROC[h: Handle, c: Conversation, o: fortytwo.FORTYTWOPROG2] = { questionType: fortytwo.QuestionType; randomNumbers: fortytwo.SeqType0; out: fortytwo.AnswerRec; questionType _ fortytwoGetPut.GetQuestionType[h]; { len: INT _ SunRPC.GetInt32[h]; randomNumbers _ NEW[fortytwo.SeqType0Object[len]]; FOR i: INT IN [0..len) DO randomNumbers[i] _ SunRPC.GetInt32[h]; ENDLOOP; }; out _ o.gettheanswer[o, questionType, randomNumbers]; SunRPC.StartReply[h]; fortytwoGetPut.PutAnswerRec[h, out]; }; MakeTESTTYPESPROG3Server: PUBLIC PROC[ data: REF, dotest: fortytwo.dotestProc ] RETURNS [SunRPC.Server] ~ { pseudoClient: fortytwo.TESTTYPESPROG3 ~ NEW[fortytwo.TESTTYPESPROG3Object _ [ rpcHandle ~ NIL, rpcConversation ~ NIL, data ~ data, dotest ~ dotest ]]; unbound: SunRPC.Server ~ NEW[SunRPC.ServerObject _ [ pgm ~ fortytwo.TESTTYPESPROG, version ~ fortytwo.TESTTYPES3, clientData ~ pseudoClient, serverProc ~ TESTTYPESPROG3Handler ]]; RETURN [unbound]; }; TESTTYPESPROG3Handler: SunRPC.ServerProc -- [h: Handle, c: Conversation, proc: CARD, clientData: REFANY -- RETURNS [doReply: BOOLEAN, replyTimeToLive: CARDINAL] -- = { o: fortytwo.TESTTYPESPROG3 _ NARROW[clientData]; doReply _ TRUE; replyTimeToLive _ defaultReplyTTL; SELECT proc FROM 13 => dotest3[h, c, o]; ENDCASE => ERROR SunRPC.Error[$wrongProc]; }; dotest3: PROC[h0: Handle, c0: Conversation, 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; out: fortytwo.randomTypes; a _ SunRPC.GetReal[h0]; b _ SunRPC.GetDReal[h0]; [] _ SunRPC.GetByte[h0]; [] _ SunRPC.GetByte[h0]; [] _ SunRPC.GetByte[h0]; c _ SunRPC.GetByte[h0]; d _ SunRPC.GetInt32[h0]; e _ SunRPC.GetInt32[h0]; f _ SunRPC.GetInt32[h0]; [] _ SunRPC.GetByte[h0]; [] _ SunRPC.GetByte[h0]; [] _ SunRPC.GetByte[h0]; g _ SunRPC.GetByte[h0]; h _ SunRPC.GetCard32[h0]; i _ SunRPC.GetCard32[h0]; j _ SunRPC.GetCard32[h0]; { len: INT _ SunRPC.GetInt32[h0]; k _ NEW[fortytwo.SeqType2Object[len]]; FOR i: INT IN [0..len) DO k[i] _ fortytwoGetPut.Gettuple[h0]; ENDLOOP; }; FOR i: INT IN [0..3) DO l[i] _ SunRPC.GetByte[h0]; ENDLOOP; SunRPC.GetAlign[h0]; { len: INT _ SunRPC.GetInt32[h0]; m _ NEW[fortytwo.SeqType3Object[len]]; FOR i: INT IN [0..len) DO [] _ SunRPC.GetByte[h0]; [] _ SunRPC.GetByte[h0]; [] _ SunRPC.GetByte[h0]; m[i] _ SunRPC.GetByte[h0]; ENDLOOP; }; out _ o.dotest[o, a, b, c, d, e, f, g, h, i, j, k, l, m]; SunRPC.StartReply[h0]; fortytwoGetPut.PutrandomTypes[h0, out]; }; END.