<> <> <> <> <> <> <> DIRECTORY SRPCCalls USING [ ExportSunRPCInterface ], SunRPC, ThrushSunRPC, ThSmartsSunExport, ThSmartsSunRPC, ThSmartsSunRPCServer; ThSmartsSunRPCServerStub: CEDAR PROGRAM IMPORTS SRPCCalls, SunRPC, ThSmartsSunRPCServer EXPORTS ThSmartsSunExport ~ { OPEN ThSmartsSunRPC, ThSmartsSunRPCServer; Handle: TYPE ~ SunRPC.Handle; SubstitutionCaller: PROC [h: SunRPC.Handle, beginReturn: SunRPCBeginReturnProc] ~ { shh: CARD32; convEvent: ThrushSunRPC.ConvEvent; oldPartyID: CARD32; newPartyID: CARD32; { shh _ SunRPC.GetCard32[h]; }; { convEvent.self.partyID _ SunRPC.GetCard32[h]; convEvent.self.smartsID _ SunRPC.GetCard32[h]; convEvent.self.convID _ SunRPC.GetCard32[h]; convEvent.self.state _ VAL[CARDINAL[SunRPC.GetCard32[h]]]; convEvent.self.stateID _ SunRPC.GetCard32[h]; convEvent.other.partyID _ SunRPC.GetCard32[h]; convEvent.other.smartsID _ SunRPC.GetCard32[h]; convEvent.other.convID _ SunRPC.GetCard32[h]; convEvent.other.state _ VAL[CARDINAL[SunRPC.GetCard32[h]]]; convEvent.other.stateID _ SunRPC.GetCard32[h]; convEvent.time _ SunRPC.GetCard32[h]; convEvent.reason _ SunRPC.GetRope[h]; convEvent.comment _ SunRPC.GetRope[h]; }; { oldPartyID _ SunRPC.GetCard32[h]; }; { newPartyID _ SunRPC.GetCard32[h]; }; [] _ Substitution[h, shh, convEvent, oldPartyID, newPartyID]; beginReturn[h]; }; ReportActionCaller: PROC [h: SunRPC.Handle, beginReturn: SunRPCBeginReturnProc] ~ { shh: CARD32; report: ThrushSunRPC.ActionReport; { shh _ SunRPC.GetCard32[h]; }; { report.self.partyID _ SunRPC.GetCard32[h]; report.self.smartsID _ SunRPC.GetCard32[h]; report.self.convID _ SunRPC.GetCard32[h]; report.self.state _ VAL[CARDINAL[SunRPC.GetCard32[h]]]; report.self.stateID _ SunRPC.GetCard32[h]; report.other.partyID _ SunRPC.GetCard32[h]; report.other.smartsID _ SunRPC.GetCard32[h]; report.other.convID _ SunRPC.GetCard32[h]; report.other.state _ VAL[CARDINAL[SunRPC.GetCard32[h]]]; report.other.stateID _ SunRPC.GetCard32[h]; report.requestingParty _ SunRPC.GetCard32[h]; report.actionID _ SunRPC.GetCard32[h]; report.actionClass _ SunRPC.GetRope[h]; report.actionType _ SunRPC.GetRope[h]; report.actionInfo _ SunRPC.GetRope[h]; }; [] _ ReportAction[h, shh, report]; beginReturn[h]; }; CheckInCaller: PROC [h: SunRPC.Handle, beginReturn: SunRPCBeginReturnProc] ~ { shh: CARD32; credentials: ThrushSunRPC.Credentials; voicePath: BOOLEAN; reason: ROPE; remark: ROPE; nextScheduledCheck: INT32; { shh _ SunRPC.GetCard32[h]; }; { credentials.partyID _ SunRPC.GetCard32[h]; credentials.smartsID _ SunRPC.GetCard32[h]; credentials.convID _ SunRPC.GetCard32[h]; credentials.state _ VAL[CARDINAL[SunRPC.GetCard32[h]]]; credentials.stateID _ SunRPC.GetCard32[h]; }; { voicePath _ SunRPCGetBool[h]; }; { reason _ SunRPC.GetRope[h]; }; { remark _ SunRPC.GetRope[h]; }; { nextScheduledCheck _ SunRPC.GetInt32[h]; }; [] _ CheckIn[h, shh, credentials, voicePath, reason, remark, nextScheduledCheck]; beginReturn[h]; }; ProgressCaller: PROC [h: SunRPC.Handle, beginReturn: SunRPCBeginReturnProc] ~ { shh: CARD32; convEvent: ThrushSunRPC.ConvEvent; { shh _ SunRPC.GetCard32[h]; }; { convEvent.self.partyID _ SunRPC.GetCard32[h]; convEvent.self.smartsID _ SunRPC.GetCard32[h]; convEvent.self.convID _ SunRPC.GetCard32[h]; convEvent.self.state _ VAL[CARDINAL[SunRPC.GetCard32[h]]]; convEvent.self.stateID _ SunRPC.GetCard32[h]; convEvent.other.partyID _ SunRPC.GetCard32[h]; convEvent.other.smartsID _ SunRPC.GetCard32[h]; convEvent.other.convID _ SunRPC.GetCard32[h]; convEvent.other.state _ VAL[CARDINAL[SunRPC.GetCard32[h]]]; convEvent.other.stateID _ SunRPC.GetCard32[h]; convEvent.time _ SunRPC.GetCard32[h]; convEvent.reason _ SunRPC.GetRope[h]; convEvent.comment _ SunRPC.GetRope[h]; }; [] _ Progress[h, shh, convEvent]; beginReturn[h]; }; SunRPCBeginReturnProc: TYPE ~ PROC [h: Handle]; Server: SunRPC.ServerProc ~ { <<[h: Handle, c: Conversation, proc: CARD, clientData: REF] RETURNS [doReply: BOOL, replyTimeToLive: CARDINAL]>> ENABLE { }; beginReturn: SunRPCBeginReturnProc ~ { SunRPC.StartReply[h]; <> <> <> }; doReply _ TRUE; replyTimeToLive _ 2; SELECT proc FROM 3 => SubstitutionCaller[h, beginReturn]; 2 => ReportActionCaller[h, beginReturn]; 4 => CheckInCaller[h, beginReturn]; 1 => ProgressCaller[h, beginReturn]; ENDCASE => { ERROR SunRPC.Error[$wrongProc]; }; }; SunRPCGetBool: PROC [h: Handle] RETURNS [BOOL] ~ INLINE { RETURN [SunRPC.GetCard32[h] # 0] }; SunRPCPutBool: PROC [h: Handle, bool: BOOL] ~ INLINE { SunRPC.PutCard32[h, IF bool THEN 1 ELSE 0] }; <<>> <> sunPgm: CARD _ 390910; -- decimal program number sunPgmVersion: CARD _ 1; ExportInterface: PUBLIC PROC [port: CARD_0] RETURNS [uniquePort: CARD] ~ { uniquePort _ SRPCCalls.ExportSunRPCInterface[port, Server, sunPgm, sunPgmVersion]; }; }... <> <> <> <> <> <> <> <> <> <>