DIRECTORY Commander, fortytwo, fourtwo, IO, Rope, SunRPC, SunRPCAuth, SunRPCBinding, ThisMachine; fortytwoClientMain: CEDAR PROGRAM IMPORTS Commander, fortytwo, IO, Rope, SunRPC, SunRPCAuth, SunRPCBinding, ThisMachine = BEGIN OPEN fortytwo, fourtwo; ROPE: TYPE = Rope.ROPE; fortytwoClient: Commander.CommandProc = BEGIN ENABLE SunRPCBinding.Error => { cmd.out.PutF1["SunRPCBinding.Error: %g\n", [rope[explanation]] ] }; thisMachineName: ROPE ¬ ThisMachine.Name[]; h: SunRPC.Handle ¬ SunRPCBinding.Import[hostName: thisMachineName, pgm: fortytwo.FORTYTWOPROG, version: fortytwo.FORTYTWOVERS1]; h1: fortytwo.FORTYTWOPROG1; h2: fortytwo.FORTYTWOPROG2; h3: fortytwo.TESTTYPESPROG3; val: INT; qr: questionRec; ar: answerRec; tqr: trueQuestionRec; tar: trueAnswerRec; tqr2: trueQuestionRec; tar2: trueAnswerRec; aA: ROPE; r: REF cosmic TheANSWERObject; r1: REF silly TheANSWERObject; rtq: randomTypes; rta: randomTypes; IO.PutRope[cmd.out, "Hello from the fortytwo client.\n"]; h1 ¬ fortytwo.MakeFORTYTWOPROG1Client[h, SunRPCAuth.Initiate[]]; qr.theQuestion ¬ "6x9"; qr.aRandomNumber ¬ 13; qr.anotherQuestion ¬ "7x10\000"; ar _ h1.getanswer[h1, "6x9", 13, "7x10\000"]; IO.PutRope[cmd.out, "Results of GETANSWER:\n"]; IO.PutF1[cmd.out, "theAnswer: %g\n", IO.int[ar.theAnswer]]; IO.PutF1[cmd.out, "aDifferentAnswer: %g\n", IO.rope[ar.aDifferentAnswer]]; aA ¬ IO.PutFR1["%g", IO.text[ar.anotherAnswer]]; IO.PutF[cmd.out, "anotherAnswer: (%g) %g\n", IO.int[Rope.Length[aA]], IO.rope[aA]]; IO.PutF1[cmd.out, "anotherDifferentAnswer: %g\n", IO.int[ar.anotherDifferentAnswer­]]; tqr.questionType ¬ cosmic; tqr.randomNumbers ¬ NEW [SeqType0Object[1]]; tqr.randomNumbers­[0] ¬ 17; tar ¬ h1.gettrueanswer[h1, cosmic, tqr.randomNumbers]; IO.PutRope[cmd.out, "\nResult of GETTRUEANSWER:\n"]; IO.PutF1[cmd.out, "tellingTheTruth: %g\n", IO.bool[tar.tellingTheTruth]]; IO.PutF[cmd.out, "theTruth: (%g, %g, %g)\n", IO.int[tar.theTruth[0]], IO.int[tar.theTruth[1]], IO.int[tar.theTruth[2]]]; r ¬ NARROW[tar.theTRUTH]; IO.PutF1[cmd.out, "theTRUTH.truthType: %g\n", IO.int[ORD[r.truthType]]]; IO.PutF1[cmd.out, "theTRUTH.c: %g\n", IO.int[r.c]]; val ¬ h1.getbogusanswer[h1]; IO.PutRope[cmd.out, "\nResults of GETBOGUSANSWER:\n"]; IO.PutF1[cmd.out, "rtq: %g\n", IO.int[val]]; h1.dontanswer[h1, 10]; IO.PutRope[cmd.out, "\nResults of DONTANSWER:\n"]; SunRPC.Destroy[h]; h ¬ SunRPCBinding.Import[hostName: thisMachineName, pgm: fortytwo.FORTYTWOPROG, version: fortytwo.FORTYTWOVERS2, transport: $UDP]; h2 ¬ fortytwo.MakeFORTYTWOPROG2Client[h, SunRPCAuth.Initiate[]]; tqr2.questionType ¬ silly; tqr2.randomNumbers ¬ NEW [SeqType0Object[2]]; tqr2.randomNumbers­[0] ¬ 512; tqr2.randomNumbers­[1] ¬ 513; tar2 ¬ h2.gettheanswer[h2, silly, tqr2.randomNumbers]; IO.PutRope[cmd.out, "\nResult of GETTHEANSWER:\n"]; IO.PutF1[cmd.out, "tellingTheTruth: %g\n", IO.bool[tar2.tellingTheTruth]]; IO.PutF[cmd.out, "theTruth: (%g, %g, %g)\n", IO.int[tar2.theTruth[0]], IO.int[tar2.theTruth[1]], IO.int[tar2.theTruth[2]]]; r1 ¬ NARROW[tar2.theTRUTH]; IO.PutF1[cmd.out, "theTRUTH.truthType: %g\n", IO.int[ORD[r1.truthType]]]; IO.PutF1[cmd.out, "theTRUTH.d.theAnswer: %g\n", IO.int[r1.d.theAnswer]]; IO.PutF1[cmd.out, "theTRUTH.d.aDifferentAnswer: %g\n", IO.rope[r1.d.aDifferentAnswer]]; IO.PutF1[cmd.out, "theTRUTH.d.anotherDifferentAnswer: %g\n", IO.int[r1.d.anotherDifferentAnswer­]]; SunRPC.Destroy[h]; h ¬ SunRPCBinding.Import[hostName: thisMachineName, pgm: fortytwo.TESTTYPESPROG, version: fortytwo.TESTTYPES3]; h3 ¬ fortytwo.MakeTESTTYPESPROG3Client[h, SunRPCAuth.Initiate[]]; rtq.a ¬ 3.1416; rtq.b ¬ 2.71828; rtq.c ¬ ORD['c]; rtq.d ¬ 13; rtq.e ¬ 42; rtq.f ¬ 137; rtq.g ¬ 129; rtq.h ¬ 14; rtq.i ¬ 43; rtq.j ¬ 138; rtq.k ¬ NEW[fortytwo.SeqType2Object[2]]; rtq.k­[0].x := -1; rtq.k­[0].y := -1; rtq.k­[1].x := 1; rtq.k­[1].y := 1; rtq.l[0] ¬ ORD['x]; rtq.l[1] ¬ ORD['x]; rtq.l[2] ¬ ORD['x]; rtq.m := NEW[fortytwo.SeqType3Object[2]]; rtq.m­[0] := 81; rtq.m­[1] := 82; rta ¬ h3.dotest[h3, 3.1416, 2.71828, ORD['c], 13, 42, 137, 129, 14, 43, 138, rtq.k, rtq.l, rtq.m]; IO.PutRope[cmd.out, "\nResult of DOTEST:\n"]; IO.PutF1[cmd.out, "a: %g\n", IO.real[rta.a]]; IO.PutF1[cmd.out, "c: %g\n", IO.char[VAL[rta.c]]]; IO.PutF1[cmd.out, "d: %g\n", IO.int[rta.d]]; IO.PutF1[cmd.out, "e: %g\n", IO.int[rta.e]]; IO.PutF1[cmd.out, "f: %g\n", IO.int[rta.f]]; IO.PutF1[cmd.out, "g: %g\n", IO.int[rta.g]]; IO.PutF1[cmd.out, "h: %g\n", IO.int[rta.h]]; IO.PutF1[cmd.out, "i: %g\n", IO.int[rta.i]]; IO.PutF1[cmd.out, "j: %g\n", IO.int[rta.j]]; IO.PutFL[cmd.out, "k: (%g) {(%g, %g), (%g, %g)}\n", LIST[IO.int[rta.k.size], IO.int[rta.k­[0].x], IO.int[rta.k­[0].y], IO.int[rta.k­[1].x], IO.int[rta.k­[1].y] ]]; IO.PutF[cmd.out, "l: {%g%g%g}\n", IO.char[VAL[rta.l[0]]], IO.char[VAL[rta.l[1]]], IO.char[VAL[rta.l[2]]]]; IO.PutF[cmd.out, "m: (%g) {%g, %g}\n", IO.int[rta.m.size], IO.int[rta.m­[0]], IO.int[rta.m­[1]]]; END; usage: ROPE = " \tClient program for fortytwo RPC server."; Commander.Register["fortytwoClient", fortytwoClient, usage]; END. ’ fortytwoClientMain.mesa Copyright Σ 1992 by Xerox Corporation. All rights reserved. Theimer, July 7, 1992 3:40 pm PDT Willie-s, May 26, 1992 4:00 pm PDT Κ”•NewlineDelimiter –(cedarcode) style™šœ™Jšœ Οeœ1™