DictionaryP1313V1ServerImpl.Mesa
Copyright Ó 1989 1992, by Xerox Corporation. All rights reserved.
Generated by BJackson.pa at March 7, 1990 0:56:31 am PST
using Sirocco [2.0] of February 10, 1989 6:26:26 pm PST
Willie-s, May 22, 1992 2:08 pm PDT
DIRECTORY
CrRPC,
DictionaryP1313V1;
DictionaryP1313V1ServerImpl: CEDAR PROGRAM
IMPORTS CrRPC, DictionaryP1313V1 ~ {
OPEN DictionaryP1313V1;
PronunciationCaller: PROC [h: CrRPC.Handle, s: CrRPC.STREAM, beginReturn: CrRPC.BeginReturnProc] ~ {
word: ROPE;
dictionary: ROPE;
string: ROPE;
{
word ¬ CrRPC.GetRope[s];
};
{
dictionary ¬ CrRPC.GetRope[s];
};
[string] ¬ Pronunciation[h, word, dictionary];
beginReturn[h];
{
CrRPC.PutRope[s, string];
};
};
AnalyzeCaller: PROC [h: CrRPC.Handle, s: CrRPC.STREAM, beginReturn: CrRPC.BeginReturnProc] ~ {
word: ROPE;
language: ROPE;
analyses: ROPE;
{
word ¬ CrRPC.GetRope[s];
};
{
language ¬ CrRPC.GetRope[s];
};
[analyses] ¬ Analyze[h, word, language];
beginReturn[h];
{
CrRPC.PutRope[s, analyses];
};
};
SearchForWordCaller: PROC [h: CrRPC.Handle, s: CrRPC.STREAM, beginReturn: CrRPC.BeginReturnProc] ~ {
unparsedClasses: ROPE;
minKeyWords: INT16;
minWord: INT16;
maxWord: INT16;
dictionary: ROPE;
intersectionResults: IntersectionResults;
{
unparsedClasses ¬ CrRPC.GetRope[s];
};
{
minKeyWords ¬ CrRPC.GetInt16[s];
};
{
minWord ¬ CrRPC.GetInt16[s];
};
{
maxWord ¬ CrRPC.GetInt16[s];
};
{
dictionary ¬ CrRPC.GetRope[s];
};
[intersectionResults] ¬ SearchForWord[h, unparsedClasses, minKeyWords, minWord, maxWord, dictionary];
beginReturn[h];
{
MProc46[h, s, intersectionResults];
};
};
SynonymsCaller: PROC [h: CrRPC.Handle, s: CrRPC.STREAM, beginReturn: CrRPC.BeginReturnProc] ~ {
word: ROPE;
dictionary: ROPE;
synonymClasses: SynonymClasses;
{
word ¬ CrRPC.GetRope[s];
};
{
dictionary ¬ CrRPC.GetRope[s];
};
[synonymClasses] ¬ Synonyms[h, word, dictionary];
beginReturn[h];
{
MProc47[h, s, synonymClasses];
};
};
GetDefinitionCaller: PROC [h: CrRPC.Handle, s: CrRPC.STREAM, beginReturn: CrRPC.BeginReturnProc] ~ {
word: ROPE;
dictionary: ROPE;
definition: Definition;
{
word ¬ CrRPC.GetRope[s];
};
{
dictionary ¬ CrRPC.GetRope[s];
};
[definition] ¬ GetDefinition[h, word, dictionary];
beginReturn[h];
{
CrRPC.PutRope[s, definition.definition];
MProc48[h, s, definition.runs];
};
};
GetLanguagesCaller: PROC [h: CrRPC.Handle, s: CrRPC.STREAM, beginReturn: CrRPC.BeginReturnProc] ~ {
user: ROPE;
languages: Languages;
{
user ¬ CrRPC.GetRope[s];
};
[languages] ¬ GetLanguages[h, user];
beginReturn[h];
{
MProc49[h, s, languages];
};
};
NewSearchForWordCaller: PROC [h: CrRPC.Handle, s: CrRPC.STREAM, beginReturn: CrRPC.BeginReturnProc] ~ {
synonymClasses: SynonymClasses;
minKeyWords: INT16;
minWord: INT16;
maxWord: INT16;
dictionary: ROPE;
intersectionResults: IntersectionResults;
{
synonymClasses ¬ UProc50[h, s];
};
{
minKeyWords ¬ CrRPC.GetInt16[s];
};
{
minWord ¬ CrRPC.GetInt16[s];
};
{
maxWord ¬ CrRPC.GetInt16[s];
};
{
dictionary ¬ CrRPC.GetRope[s];
};
[intersectionResults] ¬ NewSearchForWord[h, synonymClasses, minKeyWords, minWord, maxWord, dictionary];
beginReturn[h];
{
MProc46[h, s, intersectionResults];
};
};
ConjugateCaller: PROC [h: CrRPC.Handle, s: CrRPC.STREAM, beginReturn: CrRPC.BeginReturnProc] ~ {
word: ROPE;
form: ROPE;
alternates: ROPE;
language: ROPE;
conjugations: Conjugations;
{
word ¬ CrRPC.GetRope[s];
};
{
form ¬ CrRPC.GetRope[s];
};
{
alternates ¬ CrRPC.GetRope[s];
};
{
language ¬ CrRPC.GetRope[s];
};
[conjugations] ¬ Conjugate[h, word, form, alternates, language];
beginReturn[h];
{
MProc51[h, s, conjugations];
};
};
ProofReadCaller: PROC [h: CrRPC.Handle, s: CrRPC.STREAM, beginReturn: CrRPC.BeginReturnProc] ~ {
paragraph: ROPE;
language: ROPE;
selection: Selection;
{
paragraph ¬ CrRPC.GetRope[s];
};
{
language ¬ CrRPC.GetRope[s];
};
[selection] ¬ ProofRead[h, paragraph, language];
beginReturn[h];
{
CrRPC.PutInt16[s, selection.start];
CrRPC.PutInt16[s, selection.length];
};
};
EnumerateCaller: PROC [h: CrRPC.Handle, s: CrRPC.STREAM, beginReturn: CrRPC.BeginReturnProc] ~ {
wordNumber: INT32;
dictionary: ROPE;
definitions: Definition;
{
wordNumber ¬ CrRPC.GetInt32[s];
};
{
dictionary ¬ CrRPC.GetRope[s];
};
[definitions] ¬ Enumerate[h, wordNumber, dictionary];
beginReturn[h];
{
CrRPC.PutRope[s, definitions.definition];
MProc48[h, s, definitions.runs];
};
};
EnumerateRawCaller: PROC [h: CrRPC.Handle, s: CrRPC.STREAM, beginReturn: CrRPC.BeginReturnProc] ~ {
wordNumber: INT32;
codes: Codes;
dictionary: ROPE;
rawDefinition: RawDefinition;
{
wordNumber ¬ CrRPC.GetInt32[s];
};
{
codes ¬ UProc52[h, s];
};
{
dictionary ¬ CrRPC.GetRope[s];
};
[rawDefinition] ¬ EnumerateRaw[h, wordNumber, codes, dictionary];
beginReturn[h];
{
MProc53[h, s, rawDefinition];
};
};
DictionariesCaller: PROC [h: CrRPC.Handle, s: CrRPC.STREAM, beginReturn: CrRPC.BeginReturnProc] ~ {
user: ROPE;
dictionariesAvailable: DictionariesAvailable;
{
user ¬ CrRPC.GetRope[s];
};
[dictionariesAvailable] ¬ Dictionaries[h, user];
beginReturn[h];
{
MProc54[h, s, dictionariesAvailable];
};
};
CorrectionsCaller: PROC [h: CrRPC.Handle, s: CrRPC.STREAM, beginReturn: CrRPC.BeginReturnProc] ~ {
word: ROPE;
language: ROPE;
words: Words;
{
word ¬ CrRPC.GetRope[s];
};
{
language ¬ CrRPC.GetRope[s];
};
[words] ¬ Corrections[h, word, language];
beginReturn[h];
{
MProc55[h, s, words];
};
};
RawSearchForWordCaller: PROC [h: CrRPC.Handle, s: CrRPC.STREAM, beginReturn: CrRPC.BeginReturnProc] ~ {
synonymClasses: SynonymClasses;
minKeyWords: INT16;
minWord: INT16;
maxWord: INT16;
dictionary: ROPE;
rawIntersectionResults: RawIntersectionResults;
{
synonymClasses ¬ UProc50[h, s];
};
{
minKeyWords ¬ CrRPC.GetInt16[s];
};
{
minWord ¬ CrRPC.GetInt16[s];
};
{
maxWord ¬ CrRPC.GetInt16[s];
};
{
dictionary ¬ CrRPC.GetRope[s];
};
[rawIntersectionResults] ¬ RawSearchForWord[h, synonymClasses, minKeyWords, minWord, maxWord, dictionary];
beginReturn[h];
{
MProc56[h, s, rawIntersectionResults];
};
};
CountWordsCaller: PROC [h: CrRPC.Handle, s: CrRPC.STREAM, beginReturn: CrRPC.BeginReturnProc] ~ {
paragraph: ROPE;
language: ROPE;
longInteger: INT32;
{
paragraph ¬ CrRPC.GetRope[s];
};
{
language ¬ CrRPC.GetRope[s];
};
[longInteger] ¬ CountWords[h, paragraph, language];
beginReturn[h];
{
CrRPC.PutInt32[s, longInteger];
};
};
GetLooksCaller: PROC [h: CrRPC.Handle, s: CrRPC.STREAM, beginReturn: CrRPC.BeginReturnProc] ~ {
dictionary: ROPE;
looks: Looks;
{
dictionary ¬ CrRPC.GetRope[s];
};
[looks] ¬ GetLooks[h, dictionary];
beginReturn[h];
{
MProc57[h, s, looks];
};
};
ConvertWordNumberCaller: PROC [h: CrRPC.Handle, s: CrRPC.STREAM, beginReturn: CrRPC.BeginReturnProc] ~ {
wordNumber: INT32;
language: ROPE;
word: ROPE;
{
wordNumber ¬ CrRPC.GetInt32[s];
};
{
language ¬ CrRPC.GetRope[s];
};
[word] ¬ ConvertWordNumber[h, wordNumber, language];
beginReturn[h];
{
CrRPC.PutRope[s, word];
};
};
StatusCaller: PROC [h: CrRPC.Handle, s: CrRPC.STREAM, beginReturn: CrRPC.BeginReturnProc] ~ {
string: ROPE;
[string] ¬ Status[h];
beginReturn[h];
{
CrRPC.PutRope[s, string];
};
};
Server: CrRPC.ServerProc ~ {
[h: Handle, s: STREAM, pgm: CARD32, pgmVersion: CARD16, proc: CARD16, beginReturn: BeginReturnProc, beginError: BeginErrorProc, beginReject: BeginRejectProc]
ENABLE {
DictionaryP1313V1.UseCourier => { -- (2 )
beginError[h, 2 ];
GOTO Finished;
};
DictionaryP1313V1.RemoteError => { -- (1 )
beginError[h, 1 ];
CrRPC.PutRope[s, string];
GOTO Finished;
};
};
IF (pgmVersion # 1) THEN {
beginReject[h, CrRPC.noSuchVersion];
CrRPC.PutCard16[s, 1]; --low
CrRPC.PutCard16[s, 1]; --high
RETURN
};
SELECT proc FROM
12 => PronunciationCaller[h, s, beginReturn];
2 => AnalyzeCaller[h, s, beginReturn];
16 => SearchForWordCaller[h, s, beginReturn];
17 => SynonymsCaller[h, s, beginReturn];
11 => GetDefinitionCaller[h, s, beginReturn];
1 => GetLanguagesCaller[h, s, beginReturn];
18 => NewSearchForWordCaller[h, s, beginReturn];
8 => ConjugateCaller[h, s, beginReturn];
4 => ProofReadCaller[h, s, beginReturn];
14 => EnumerateCaller[h, s, beginReturn];
15 => EnumerateRawCaller[h, s, beginReturn];
10 => DictionariesCaller[h, s, beginReturn];
5 => CorrectionsCaller[h, s, beginReturn];
19 => RawSearchForWordCaller[h, s, beginReturn];
7 => CountWordsCaller[h, s, beginReturn];
13 => GetLooksCaller[h, s, beginReturn];
3 => ConvertWordNumberCaller[h, s, beginReturn];
6 => StatusCaller[h, s, beginReturn];
ENDCASE => {
beginReject[h, CrRPC.noSuchProcedure];
};
EXITS
Finished => { NULL };
};
Unmarshal / Marshal Procs --
MProc55: PROC [h: CrRPC.Handle, s: CrRPC.STREAM, val: Words] ~ {
CrRPC.PutCard16[s, val.length];
FOR i58: CARDINAL IN [0..val.length) DO
CrRPC.PutRope[s, val.body[i58]];
ENDLOOP;
};
MProc57: PROC [h: CrRPC.Handle, s: CrRPC.STREAM, val: Looks] ~ {
CrRPC.PutCard16[s, val.length];
FOR i59: CARDINAL IN [0..val.length) DO
MProc60[h, s, val.body[i59]];
ENDLOOP;
};
MProc54: PROC [h: CrRPC.Handle, s: CrRPC.STREAM, val: DictionariesAvailable] ~ {
CrRPC.PutCard16[s, val.length];
FOR i61: CARDINAL IN [0..val.length) DO
CrRPC.PutRope[s, val.body[i61]];
ENDLOOP;
};
MProc56: PROC [h: CrRPC.Handle, s: CrRPC.STREAM, val: RawIntersectionResults] ~ {
CrRPC.PutCard16[s, val.length];
FOR i62: CARDINAL IN [0..val.length) DO
MProc55[h, s, val.body[i62].keys];
MProc63[h, s, val.body[i62].results];
ENDLOOP;
};
MProc47: PROC [h: CrRPC.Handle, s: CrRPC.STREAM, val: SynonymClasses] ~ {
CrRPC.PutCard16[s, val.length];
FOR i64: CARDINAL IN [0..val.length) DO
MProc65[h, s, val.body[i64]];
ENDLOOP;
};
MProc49: PROC [h: CrRPC.Handle, s: CrRPC.STREAM, val: Languages] ~ {
CrRPC.PutCard16[s, val.length];
FOR i66: CARDINAL IN [0..val.length) DO
CrRPC.PutRope[s, val.body[i66]];
ENDLOOP;
};
MProc60: PROC [h: CrRPC.Handle, s: CrRPC.STREAM, val: Looks2] ~ {
CrRPC.PutCard16[s, val.length];
FOR i67: CARDINAL IN [0..val.length) DO
CrRPC.PutRope[s, val.body[i67]];
ENDLOOP;
};
UProc50: PROC [h: CrRPC.Handle, s: CrRPC.STREAM] RETURNS [res: SynonymClasses] ~ {
{
length69: CARDINAL ~ CrRPC.GetCard16[s];
res ¬ NEW[SynonymClassesObject[length69]];
FOR i68: CARDINAL IN [0..length69) DO
res.body[i68] ¬ UProc70[h, s];
ENDLOOP;
};
};
UProc52: PROC [h: CrRPC.Handle, s: CrRPC.STREAM] RETURNS [res: Codes] ~ {
{
length72: CARDINAL ~ CrRPC.GetCard16[s];
res ¬ NEW[CodesObject[length72]];
FOR i71: CARDINAL IN [0..length72) DO
res.body[i71] ¬ CrRPC.GetRope[s];
ENDLOOP;
};
};
MProc51: PROC [h: CrRPC.Handle, s: CrRPC.STREAM, val: Conjugations] ~ {
CrRPC.PutCard16[s, val.length];
FOR i73: CARDINAL IN [0..val.length) DO
CrRPC.PutRope[s, val.body[i73].partsOfSpeech];
CrRPC.PutRope[s, val.body[i73].definition];
CrRPC.PutRope[s, val.body[i73].status];
ENDLOOP;
};
MProc65: PROC [h: CrRPC.Handle, s: CrRPC.STREAM, val: SynonymClass] ~ {
CrRPC.PutCard16[s, val.length];
FOR i74: CARDINAL IN [0..val.length) DO
CrRPC.PutRope[s, val.body[i74]];
ENDLOOP;
};
MProc48: PROC [h: CrRPC.Handle, s: CrRPC.STREAM, val: Runs] ~ {
CrRPC.PutCard16[s, val.length];
FOR i75: CARDINAL IN [0..val.length) DO
CrRPC.PutInt16[s, val.body[i75].start];
CrRPC.PutInt16[s, val.body[i75].length];
CrRPC.PutRope[s, val.body[i75].font];
ENDLOOP;
};
UProc70: PROC [h: CrRPC.Handle, s: CrRPC.STREAM] RETURNS [res: SynonymClass] ~ {
{
length77: CARDINAL ~ CrRPC.GetCard16[s];
res ¬ NEW[SynonymClassObject[length77]];
FOR i76: CARDINAL IN [0..length77) DO
res.body[i76] ¬ CrRPC.GetRope[s];
ENDLOOP;
};
};
MProc53: PROC [h: CrRPC.Handle, s: CrRPC.STREAM, val: RawDefinition] ~ {
CrRPC.PutCard16[s, val.length];
FOR i78: CARDINAL IN [0..val.length) DO
CrRPC.PutRope[s, val.body[i78].type];
CrRPC.PutRope[s, val.body[i78].text];
CrRPC.PutRope[s, val.body[i78].defaultFont];
MProc48[h, s, val.body[i78].runs];
ENDLOOP;
};
MProc46: PROC [h: CrRPC.Handle, s: CrRPC.STREAM, val: IntersectionResults] ~ {
CrRPC.PutCard16[s, val.length];
FOR i79: CARDINAL IN [0..val.length) DO
MProc55[h, s, val.body[i79].keys];
MProc55[h, s, val.body[i79].results];
ENDLOOP;
};
MProc63: PROC [h: CrRPC.Handle, s: CrRPC.STREAM, val: Integers] ~ {
CrRPC.PutCard16[s, val.length];
FOR i80: CARDINAL IN [0..val.length) DO
CrRPC.PutInt32[s, val.body[i80]];
ENDLOOP;
};
CrRPC.RegisterServerProcs[pgm~1313, pgmLoVersion~1, pgmHiVersion~1, serverProc~Server];
CrRPC.EnsureListener[class~$CMUX];
}...