SynthesizerServerToSynthesizerServerSunRPC.mesa
Copyright Ó 1990 by Xerox Corporation. All rights reserved.
Pier, May 24, 1990 12:56:29 pm PDT
Swinehart, September 19, 1990 7:17:53 am PDT
Polle Zellweger (PTZ) October 29, 1990 3:30:54 pm PST
DIRECTORY
IO,
RefID USING [ ID ],
Rope USING [ROPE],
RuntimeError USING [ UNCAUGHT ],
SRPCCalls USING [
Conversation, Error, GetSHandle, NewRPCConversation, ReleaseConversation, ReportProc, SHandle, TimeoutEnable],
SunRPC,
Thrush,
ThrushSunRPC,
ThrushSunRPCConvert,
SynthesizerServer,
SynthesizerServerRpcControl,
SynthesizerServerSunImport,
SynthesizerServerSunRPC,
SynthesizerServerSunRPCClient,
VoiceUtils
;
SynthesizerServerToSynthesizerServerSunRPC: CEDAR PROGRAM
IMPORTS IO, RuntimeError, SRPCCalls, SynthesizerServerSunRPCClient, ThrushSunRPCConvert, VoiceUtils
EXPORTS SynthesizerServerSunImport
= {
OPEN IO, ThrushSunRPCConvert;
sunSHHH: CARD32 = 0;
SHandle: TYPE ~ SRPCCalls.SHandle;
InterfaceRecord: TYPE ~ SynthesizerServerRpcControl.InterfaceRecord;
Procedures
TextToSpeech: PROC [
interface: InterfaceRecord,
shhh: Thrush.SHHH←Thrush.none,
credentials: Thrush.Credentials, -- authenticates caller
serviceID: RefID.ID, -- identifies particular service
textToSpeak: Rope.ROPE,
actionID: Thrush.ActionID,
filter: BOOLTRUE,
queueIt: BOOLTRUE
] RETURNS [nb: Thrush.NB] = {
ENABLE {
SRPCCalls.Error => { nb ← ReportError[shhh, errCode, explanation]; CONTINUE; };
RuntimeError.UNCAUGHT => { nb ← ReportError[shhh, $unknownError]; CONTINUE; };
};
srNB: ThrushSunRPC.NB;
srNB ← SynthesizerServerSunRPCClient.TextToSpeech[h: GetHandle[shhh], shhh: sunSHHH, credentials: CredentialsToSr[credentials], serviceID: serviceID, textToSpeak: ROPEToSr[textToSpeak], actionID: actionID, filter: filter, queueIt: queueIt];
nb ← SrToATOM[srNB];
};
StopSpeech: PROC [
interface: InterfaceRecord,
shhh: Thrush.SHHH←Thrush.none,
credentials: Thrush.Credentials,
serviceID: RefID.ID,
reset: BOOLFALSE
] RETURNS [nb: Thrush.NB] = {
ENABLE {
SRPCCalls.Error => { nb ← ReportError[shhh, errCode, explanation]; CONTINUE; };
RuntimeError.UNCAUGHT => { nb ← ReportError[shhh, $unknownError]; CONTINUE; };
};
srNB: ThrushSunRPC.NB;
srNB ← SynthesizerServerSunRPCClient.StopSpeech[h: GetHandle[shhh], shhh: sunSHHH, credentials: CredentialsToSr[credentials], serviceID: serviceID, reset: reset];
nb ← SrToATOM[srNB];
};
GetSynthesizerSpecifications: PROC [
interface: InterfaceRecord,
shhh: Thrush.SHHH←Thrush.none,
serviceID: RefID.ID
] RETURNS [ nb: Thrush.NB, synthesizerModel: ATOM, synthesizerVersion: ATOM ] = {
ENABLE {
SRPCCalls.Error => { nb ← ReportError[shhh, errCode, explanation]; CONTINUE; };
RuntimeError.UNCAUGHT => { nb ← ReportError[shhh, $unknownError]; CONTINUE; };
};
srNB: ThrushSunRPC.NB;
srSm, srSv: Rope.ROPE;
[srNB, srSm, srSv] ← SynthesizerServerSunRPCClient.GetSynthesizerSpecifications[h: GetHandle[shhh], shhh: sunSHHH, serviceID: serviceID];
nb ← SrToATOM[srNB];
synthesizerModel ← SrToATOM[srSm];
synthesizerVersion ← SrToATOM[srSv];
};
Handles
GetHandle: PROC[shhh: Thrush.SHHH] RETURNS [h: SunRPC.Handle] ~ {
sHandle: SHandle;
IF shhh = NIL THEN SRPCCalls.Error[$noConversationSupplied];
sHandle ← SRPCCalls.GetSHandle[shhh];
IF sHandle=NIL THEN SRPCCalls.Error[$invalidConversationSupplied];
h ← sHandle.handle;
};
Connecting
sunPgm: CARD ← 390911; -- decimal program number for VoiceRopeServer
sunPgmVersion: CARD ← 1;
sunCallTimeout: INT ← 3000;
sunCallRetries: INT ← 3;
sunCallTimeoutEnable: SRPCCalls.TimeoutEnable ← always;
ImportInterface: PUBLIC PROC [instance: Rope.ROPE] RETURNS [interface: InterfaceRecord, shhh: Thrush.SHHH] ~ {
instance should be a SunRPC address, in the form "sun#[1.2.3.4]#5", where [1.2.3.4] is the Arpa address, and 5 is the port.
shhh ← SRPCCalls.NewRPCConversation[serverName: instance, rpcProgram: sunPgm, rpcVersion: sunPgmVersion, timeoutEnable: sunCallTimeoutEnable, timeoutInMs: sunCallTimeout, retries: sunCallRetries, reportProc: ForwardReports];
SRPCCalls.GetSHandle[shhh].enabled ← TRUE;
interface ← NEW[SynthesizerServerRpcControl.InterfaceRecordObject];
interface^ ← [
clientStubTextToSpeech: TextToSpeech, clientStubStopSpeech: StopSpeech,
clientStubGetSynthesizerSpecifications: GetSynthesizerSpecifications ];
};
UnImportInterface: PUBLIC PROC [shhh: Thrush.SHHH] ~ {
SRPCCalls.ReleaseConversation[shhh];
};
ReportError: PROC[shhh: Thrush.SHHH, errCode: ATOM, explanation: Rope.ROPE←NIL]
RETURNS[nb: Thrush.NB] ~ {
sHandle: SHandle ← SRPCCalls.GetSHandle[shhh];
IF sHandle=NIL THEN RETURN;
ForwardReports[sHandle, errCode, explanation];
nb ← $callFailed;
};
ForwardReports: SRPCCalls.ReportProc ~ {
VoiceUtils.ProblemFR[remark: "Synthesizer Server Failure, code: %g, expl: %g", where: $System, a1: atom[ec], a2: rope[expl]];
};
}.
Polle Zellweger (PTZ) October 29, 1990 3:30:54 pm PST
Allow detection of NIL ropes across a SunRPC connection.
changes to: TextToSpeech