-- fortytwoGetPutImpl.mesa -- Please do not edit this file. -- It was generated using CedarRPCGen. DIRECTORY Rope, SunRPC, fortyone, fourtwo, fourtwoGetPut, fortytwo, fortytwoGetPut; fortytwoGetPutImpl: CEDAR PROGRAM IMPORTS SunRPC, fourtwoGetPut EXPORTS fortytwo, fortytwoGetPut = BEGIN Handle: TYPE = SunRPC.Handle; ROPE: TYPE = Rope.ROPE; GetQuestionType: PUBLIC PROC[h: Handle] RETURNS [res: fortytwo.QuestionType] = { res _ VAL[SunRPC.GetInt32[h]]; }; PutQuestionType: PUBLIC PROC[h: Handle, in: fortytwo.QuestionType] = { SunRPC.PutInt32[h, ORD[in]]; }; Question1TypeNames: PUBLIC ARRAY fortytwo.Question1Type OF ROPE _ [ "boooring", "cooosmic", "univeeersal", "stuuupid", "sillly" ]; GetQuestion1Type: PUBLIC PROC[h: Handle] RETURNS [res: fortytwo.Question1Type] = { res _ VAL[SunRPC.GetInt32[h]]; }; PutQuestion1Type: PUBLIC PROC[h: Handle, in: fortytwo.Question1Type] = { SunRPC.PutInt32[h, ORD[in]]; }; GetanswerRecType: PUBLIC PROC[h: Handle] RETURNS [res: fortytwo.answerRecType] = { res _ fourtwoGetPut.GetanswerRec[h]; }; PutanswerRecType: PUBLIC PROC[h: Handle, in: fortytwo.answerRecType] = { fourtwoGetPut.PutanswerRec[h, in]; }; GetTheANSWER: PUBLIC PROC[h: Handle] RETURNS [res: fortytwo.TheANSWER] = { tag: fortytwo.QuestionType; tag _ GetQuestionType[h]; SELECT tag FROM boring => { v: REF boring fortytwo.TheANSWERObject _ NEW[boring fortytwo.TheANSWERObject]; FOR i: INT IN [0..13) DO v.b[i] _ SunRPC.GetByte[h]; ENDLOOP; SunRPC.GetAlign[h]; res _ v; }; cosmic => { v: REF cosmic fortytwo.TheANSWERObject _ NEW[cosmic fortytwo.TheANSWERObject]; v.c _ SunRPC.GetInt32[h]; res _ v; }; stupid => { v: REF stupid fortytwo.TheANSWERObject _ NEW[stupid fortytwo.TheANSWERObject]; res _ v; }; silly => { v: REF silly fortytwo.TheANSWERObject _ NEW[silly fortytwo.TheANSWERObject]; IF SunRPC.GetInt32[h] # 0 THEN { v.d _ NEW[fourtwo.answerRec]; v.d^ _ fourtwoGetPut.GetanswerRec[h]; } ELSE v.d _ NIL; res _ v; }; universal => { v: REF universal fortytwo.TheANSWERObject _ NEW[universal fortytwo.TheANSWERObject]; IF SunRPC.GetInt32[h] # 0 THEN { v.d _ NEW[fourtwo.answerRec]; v.d^ _ fourtwoGetPut.GetanswerRec[h]; } ELSE v.d _ NIL; res _ v; }; ENDCASE => NULL; }; PutTheANSWER: PUBLIC PROC[h: Handle, in: fortytwo.TheANSWER] = { PutQuestionType[h, in.truthType]; SELECT in.truthType FROM boring => { v: REF boring fortytwo.TheANSWERObject _ NARROW[in]; FOR i: INT IN [0..13) DO SunRPC.PutByte[h, v.b[i]]; ENDLOOP; SunRPC.PutAlign[h]; }; cosmic => { v: REF cosmic fortytwo.TheANSWERObject _ NARROW[in]; SunRPC.PutInt32[h, v.c]; }; stupid => { v: REF stupid fortytwo.TheANSWERObject _ NARROW[in]; }; silly => { v: REF silly fortytwo.TheANSWERObject _ NARROW[in]; IF v.d = NIL THEN { SunRPC.PutInt32[h, 0]; } ELSE { SunRPC.PutInt32[h, 1]; fourtwoGetPut.PutanswerRec[h, v.d^]; }; }; universal => { v: REF universal fortytwo.TheANSWERObject _ NARROW[in]; IF v.d = NIL THEN { SunRPC.PutInt32[h, 0]; } ELSE { SunRPC.PutInt32[h, 1]; fourtwoGetPut.PutanswerRec[h, v.d^]; }; }; ENDCASE => NULL; }; GetYetAnotherAnswer: PUBLIC PROC[h: Handle] RETURNS [res: fortytwo.YetAnotherAnswer] = { tag: INT32; tag _ VAL[SunRPC.GetInt32[h]]; SELECT tag FROM 0 => { v: REF v0 fortytwo.YetAnotherAnswerObject _ NEW[v0 fortytwo.YetAnotherAnswerObject]; v.answer _ GetQuestionType[h]; res _ v; }; 1 => { v: REF v1 fortytwo.YetAnotherAnswerObject _ NEW[v1 fortytwo.YetAnotherAnswerObject]; v.a _ SunRPC.GetInt32[h]; res _ v; }; ENDCASE => { v: REF default fortytwo.YetAnotherAnswerObject _ NEW[default fortytwo.YetAnotherAnswerObject]; v.responseType _ tag; res _ v; }; }; PutYetAnotherAnswer: PUBLIC PROC[h: Handle, in: fortytwo.YetAnotherAnswer] = { SunRPC.PutInt32[h, ORD[in.responseType]]; SELECT in.responseType FROM 0 => { v: REF v0 fortytwo.YetAnotherAnswerObject _ NARROW[in]; PutQuestionType[h, v.answer]; }; 1 => { v: REF v1 fortytwo.YetAnotherAnswerObject _ NARROW[in]; SunRPC.PutInt32[h, v.a]; }; ENDCASE => { v: REF default fortytwo.YetAnotherAnswerObject _ NARROW[in]; }; }; GettrueAnswerRec: PUBLIC PROC[h: Handle] RETURNS [res: fortytwo.trueAnswerRec] = { res.tellingTheTruth _ SunRPC.GetInt32[h] # 0; FOR i: INT IN [0..fortyone.TRUTHSIZE) DO res.theTruth[i] _ SunRPC.GetInt32[h]; ENDLOOP; res.theTRUTH _ GetTheANSWER[h]; }; PuttrueAnswerRec: PUBLIC PROC[h: Handle, in: fortytwo.trueAnswerRec] = { SunRPC.PutInt32[h, IF in.tellingTheTruth THEN 1 ELSE 0]; FOR i: INT IN [0..fortyone.TRUTHSIZE) DO SunRPC.PutInt32[h, in.theTruth[i]]; ENDLOOP; PutTheANSWER[h, in.theTRUTH]; }; GettrueQuestionRec: PUBLIC PROC[h: Handle] RETURNS [res: fortytwo.trueQuestionRec] = { res.questionType _ GetQuestionType[h]; { len: INT _ SunRPC.GetInt32[h]; res.randomNumbers _ NEW[fortytwo.SeqType0Object[len]]; FOR i: INT IN [0..len) DO res.randomNumbers[i] _ SunRPC.GetInt32[h]; ENDLOOP; }; }; PuttrueQuestionRec: PUBLIC PROC[h: Handle, in: fortytwo.trueQuestionRec] = { PutQuestionType[h, in.questionType]; SunRPC.PutInt32[h, in.randomNumbers.size]; FOR i: INT IN [0..in.randomNumbers.size) DO SunRPC.PutInt32[h, in.randomNumbers[i]]; ENDLOOP; }; GetQuestionRec: PUBLIC PROC[h: Handle] RETURNS [res: fortytwo.QuestionRec] = { res _ GettrueQuestionRec[h]; }; PutQuestionRec: PUBLIC PROC[h: Handle, in: fortytwo.QuestionRec] = { PuttrueQuestionRec[h, in]; }; GetAnswerRec: PUBLIC PROC[h: Handle] RETURNS [res: fortytwo.AnswerRec] = { res _ GettrueAnswerRec[h]; }; PutAnswerRec: PUBLIC PROC[h: Handle, in: fortytwo.AnswerRec] = { PuttrueAnswerRec[h, in]; }; GetQuestionRecPtr: PUBLIC PROC[h: Handle] RETURNS [res: fortytwo.QuestionRecPtr] = { IF SunRPC.GetInt32[h] # 0 THEN { res _ NEW[fortytwo.QuestionRec]; res^ _ GetQuestionRec[h]; } ELSE res _ NIL; }; PutQuestionRecPtr: PUBLIC PROC[h: Handle, in: fortytwo.QuestionRecPtr] = { IF in = NIL THEN { SunRPC.PutInt32[h, 0]; } ELSE { SunRPC.PutInt32[h, 1]; PutQuestionRec[h, in^]; }; }; GetQuestionRecArray: PUBLIC PROC[h: Handle] RETURNS [res: fortytwo.QuestionRecArray] = { { len: INT _ SunRPC.GetInt32[h]; res _ NEW[fortytwo.SeqType1Object[len]]; FOR i: INT IN [0..len) DO res[i] _ GetQuestionRec[h]; ENDLOOP; }; }; PutQuestionRecArray: PUBLIC PROC[h: Handle, in: fortytwo.QuestionRecArray] = { SunRPC.PutInt32[h, in.size]; FOR i: INT IN [0..in.size) DO PutQuestionRec[h, in[i]]; ENDLOOP; }; GetQuestionRecArray1: PUBLIC PROC[h: Handle] RETURNS [res: fortytwo.QuestionRecArray1] = { FOR i: INT IN [0..13) DO res[i] _ GetQuestionRec[h]; ENDLOOP; }; PutQuestionRecArray1: PUBLIC PROC[h: Handle, in: fortytwo.QuestionRecArray1] = { FOR i: INT IN [0..13) DO PutQuestionRec[h, in[i]]; ENDLOOP; }; Gettuple: PUBLIC PROC[h: Handle] RETURNS [res: fortytwo.tuple] = { res.x _ SunRPC.GetInt32[h]; res.y _ SunRPC.GetInt32[h]; }; Puttuple: PUBLIC PROC[h: Handle, in: fortytwo.tuple] = { SunRPC.PutInt32[h, in.x]; SunRPC.PutInt32[h, in.y]; }; GetrandomTypes: PUBLIC PROC[h: Handle] RETURNS [res: fortytwo.randomTypes] = { res.a _ SunRPC.GetReal[h]; res.b _ SunRPC.GetDReal[h]; [] _ SunRPC.GetByte[h]; [] _ SunRPC.GetByte[h]; [] _ SunRPC.GetByte[h]; res.c _ SunRPC.GetByte[h]; res.d _ SunRPC.GetInt32[h]; res.e _ SunRPC.GetInt32[h]; res.f _ SunRPC.GetInt32[h]; [] _ SunRPC.GetByte[h]; [] _ SunRPC.GetByte[h]; [] _ SunRPC.GetByte[h]; res.g _ SunRPC.GetByte[h]; res.h _ SunRPC.GetCard32[h]; res.i _ SunRPC.GetCard32[h]; res.j _ SunRPC.GetCard32[h]; { len: INT _ SunRPC.GetInt32[h]; res.k _ NEW[fortytwo.SeqType2Object[len]]; FOR i: INT IN [0..len) DO res.k[i] _ Gettuple[h]; ENDLOOP; }; FOR i: INT IN [0..3) DO res.l[i] _ SunRPC.GetByte[h]; ENDLOOP; SunRPC.GetAlign[h]; { len: INT _ SunRPC.GetInt32[h]; res.m _ NEW[fortytwo.SeqType3Object[len]]; FOR i: INT IN [0..len) DO [] _ SunRPC.GetByte[h]; [] _ SunRPC.GetByte[h]; [] _ SunRPC.GetByte[h]; res.m[i] _ SunRPC.GetByte[h]; ENDLOOP; }; }; PutrandomTypes: PUBLIC PROC[h: Handle, in: fortytwo.randomTypes] = { SunRPC.PutReal[h, in.a]; SunRPC.PutDReal[h, in.b]; SunRPC.PutInt32[h, in.c]; SunRPC.PutInt32[h, in.d]; SunRPC.PutInt32[h, in.e]; SunRPC.PutInt32[h, in.f]; SunRPC.PutInt32[h, in.g]; SunRPC.PutCard32[h, in.h]; SunRPC.PutCard32[h, in.i]; SunRPC.PutCard32[h, in.j]; SunRPC.PutInt32[h, in.k.size]; FOR i: INT IN [0..in.k.size) DO Puttuple[h, in.k[i]]; ENDLOOP; FOR i: INT IN [0..3) DO SunRPC.PutByte[h, in.l[i]]; ENDLOOP; SunRPC.PutAlign[h]; SunRPC.PutInt32[h, in.m.size]; FOR i: INT IN [0..in.m.size) DO SunRPC.PutInt32[h, in.m[i]]; ENDLOOP; }; GetFooBar: PUBLIC PROC[h: Handle] RETURNS [res: fortytwo.FooBar] = { res _ SunRPC.GetInt32[h]; }; PutFooBar: PUBLIC PROC[h: Handle, in: fortytwo.FooBar] = { SunRPC.PutInt32[h, in]; }; Getfoo: PUBLIC PROC[h: Handle] RETURNS [res: fortytwo.foo] = { tag: CARD32; tag _ SunRPC.GetCard32[h]; SELECT tag FROM 1 => { v: REF v1 fortytwo.fooObject _ NEW[v1 fortytwo.fooObject]; v.a _ SunRPC.GetCard32[h]; res _ v; }; 2 => { v: REF v2 fortytwo.fooObject _ NEW[v2 fortytwo.fooObject]; { len: INT _ SunRPC.GetInt32[h]; v.b _ NEW[fortytwo.SeqType4Object[len]]; FOR i: INT IN [0..len) DO v.b[i] _ SunRPC.GetCard32[h]; ENDLOOP; }; res _ v; }; 3 => { v: REF v3 fortytwo.fooObject _ NEW[v3 fortytwo.fooObject]; FOR i: INT IN [0..42) DO [] _ SunRPC.GetByte[h]; [] _ SunRPC.GetByte[h]; [] _ SunRPC.GetByte[h]; v.c[i] _ SunRPC.GetByte[h]; ENDLOOP; res _ v; }; 4 => { v: REF v4 fortytwo.fooObject _ NEW[v4 fortytwo.fooObject]; { len: INT _ SunRPC.GetInt32[h]; v.d _ NEW[fortytwo.SeqType5Object[len]]; FOR i: INT IN [0..len) DO v.d[i] _ SunRPC.GetCard32[h]; ENDLOOP; }; res _ v; }; ENDCASE => { v: REF default fortytwo.fooObject _ NEW[default fortytwo.fooObject]; v.desc _ tag; [] _ SunRPC.GetByte[h]; [] _ SunRPC.GetByte[h]; [] _ SunRPC.GetByte[h]; v.e _ SunRPC.GetByte[h]; res _ v; }; }; Putfoo: PUBLIC PROC[h: Handle, in: fortytwo.foo] = { SunRPC.PutCard32[h, in.desc]; SELECT in.desc FROM 1 => { v: REF v1 fortytwo.fooObject _ NARROW[in]; SunRPC.PutCard32[h, v.a]; }; 2 => { v: REF v2 fortytwo.fooObject _ NARROW[in]; SunRPC.PutInt32[h, v.b.size]; FOR i: INT IN [0..v.b.size) DO SunRPC.PutCard32[h, v.b[i]]; ENDLOOP; }; 3 => { v: REF v3 fortytwo.fooObject _ NARROW[in]; FOR i: INT IN [0..42) DO SunRPC.PutInt32[h, v.c[i]]; ENDLOOP; }; 4 => { v: REF v4 fortytwo.fooObject _ NARROW[in]; SunRPC.PutInt32[h, v.d.size]; FOR i: INT IN [0..v.d.size) DO SunRPC.PutCard32[h, v.d[i]]; ENDLOOP; }; ENDCASE => { v: REF default fortytwo.fooObject _ NARROW[in]; SunRPC.PutInt32[h, v.e]; }; }; Getbarr: PUBLIC PROC[h: Handle] RETURNS [res: fortytwo.barr] = { res.a _ SunRPC.GetCard32[h]; { len: INT _ SunRPC.GetInt32[h]; res.b _ NEW[fortytwo.SeqType6Object[len]]; FOR i: INT IN [0..len) DO res.b[i] _ SunRPC.GetCard32[h]; ENDLOOP; }; FOR i: INT IN [0..13) DO [] _ SunRPC.GetByte[h]; [] _ SunRPC.GetByte[h]; [] _ SunRPC.GetByte[h]; res.c[i] _ SunRPC.GetByte[h]; ENDLOOP; IF SunRPC.GetInt32[h] # 0 THEN { res.d _ NEW[CARD32]; res.d^ _ SunRPC.GetCard32[h]; } ELSE res.d _ NIL; }; Putbarr: PUBLIC PROC[h: Handle, in: fortytwo.barr] = { SunRPC.PutCard32[h, in.a]; SunRPC.PutInt32[h, in.b.size]; FOR i: INT IN [0..in.b.size) DO SunRPC.PutCard32[h, in.b[i]]; ENDLOOP; FOR i: INT IN [0..13) DO SunRPC.PutInt32[h, in.c[i]]; ENDLOOP; IF in.d = NIL THEN { SunRPC.PutInt32[h, 0]; } ELSE { SunRPC.PutInt32[h, 1]; SunRPC.PutCard32[h, in.d^]; }; }; GetULONG: PUBLIC PROC[h: Handle] RETURNS [res: fortytwo.ULONG] = { res _ SunRPC.GetCard32[h]; }; PutULONG: PUBLIC PROC[h: Handle, in: fortytwo.ULONG] = { SunRPC.PutCard32[h, in]; }; Getfoobar: PUBLIC PROC[h: Handle] RETURNS [res: fortytwo.foobar] = { { len: INT _ SunRPC.GetInt32[h]; res _ NEW[fortytwo.SeqType7Object[len]]; FOR i: INT IN [0..len) DO res[i] _ SunRPC.GetCard32[h]; ENDLOOP; }; }; Putfoobar: PUBLIC PROC[h: Handle, in: fortytwo.foobar] = { SunRPC.PutInt32[h, in.size]; FOR i: INT IN [0..in.size) DO SunRPC.PutCard32[h, in[i]]; ENDLOOP; }; Getfoobaz: PUBLIC PROC[h: Handle] RETURNS [res: fortytwo.foobaz] = { FOR i: INT IN [0..137) DO [] _ SunRPC.GetByte[h]; [] _ SunRPC.GetByte[h]; [] _ SunRPC.GetByte[h]; res[i] _ SunRPC.GetByte[h]; ENDLOOP; }; Putfoobaz: PUBLIC PROC[h: Handle, in: fortytwo.foobaz] = { FOR i: INT IN [0..137) DO SunRPC.PutInt32[h, in[i]]; ENDLOOP; }; Getfoobarrr: PUBLIC PROC[h: Handle] RETURNS [res: fortytwo.foobarrr] = { IF SunRPC.GetInt32[h] # 0 THEN { res _ NEW[CARD32]; res^ _ SunRPC.GetCard32[h]; } ELSE res _ NIL; }; Putfoobarrr: PUBLIC PROC[h: Handle, in: fortytwo.foobarrr] = { IF in = NIL THEN { SunRPC.PutInt32[h, 0]; } ELSE { SunRPC.PutInt32[h, 1]; SunRPC.PutCard32[h, in^]; }; }; Getbar: PUBLIC PROC[h: Handle] RETURNS [res: fortytwo.bar] = { tag: BOOLEAN; tag _ VAL[SunRPC.GetInt32[h]]; SELECT tag FROM TRUE => { v: REF TRUE fortytwo.barObject _ NEW[TRUE fortytwo.barObject]; v.a _ SunRPC.GetInt32[h]; res _ v; }; FALSE => { v: REF FALSE fortytwo.barObject _ NEW[FALSE fortytwo.barObject]; [] _ SunRPC.GetByte[h]; [] _ SunRPC.GetByte[h]; [] _ SunRPC.GetByte[h]; v.b _ SunRPC.GetByte[h]; res _ v; }; ENDCASE => NULL; }; Putbar: PUBLIC PROC[h: Handle, in: fortytwo.bar] = { SunRPC.PutInt32[h, ORD[in.desc]]; SELECT in.desc FROM TRUE => { v: REF TRUE fortytwo.barObject _ NARROW[in]; SunRPC.PutInt32[h, v.a]; }; FALSE => { v: REF FALSE fortytwo.barObject _ NARROW[in]; SunRPC.PutInt32[h, v.b]; }; ENDCASE => NULL; }; GetTestNamesArray: PUBLIC PROC[h: Handle] RETURNS [res: fortytwo.TestNamesArray] = { res _ VAL[SunRPC.GetInt32[h]]; }; PutTestNamesArray: PUBLIC PROC[h: Handle, in: fortytwo.TestNamesArray] = { SunRPC.PutInt32[h, ORD[in]]; }; END.