TrickleChargeP9813V411ServerImpl.Mesa
Copyright Ó 1989, 1991, 1992 by Xerox Corporation. All rights reserved.
Willie-s, January 31, 1992 6:23 pm PST
Generated by Diebert.pa at September 15, 1989 9:59:34 am PDT
using Sirocco [2.0] of February 10, 1989 6:26:26 pm PST
DIRECTORY
CrRPC,
BulkDataP0V1,
TrickleChargeP9813V411;
TrickleChargeP9813V411ServerImpl:
CEDAR
PROGRAM
IMPORTS CrRPC, TrickleChargeP9813V411 ~ {
OPEN TrickleChargeP9813V411;
RetrieveCaller:
PROC [h: CrRPC.Handle, s: CrRPC.
STREAM, beginReturn: CrRPC.BeginReturnProc] ~ {
name: ROPE;
wantedCreatedTime: INT32;
data: CrRPC.BulkDataSink;
{
name ¬ CrRPC.GetRope[s];
};
{
wantedCreatedTime ¬ CrRPC.GetInt32[s];
};
TRUSTED {
data ¬ CrRPC.GetBulkDataSink[h, s];
};
[] ¬ Retrieve[h, name, wantedCreatedTime, data];
beginReturn[h];
};
EnumerateForInfoCaller:
PROC [h: CrRPC.Handle, s: CrRPC.
STREAM, beginReturn: CrRPC.BeginReturnProc] ~ {
pattern: ROPE;
info: CrRPC.BulkDataSink;
{
pattern ¬ CrRPC.GetRope[s];
};
TRUSTED {
info ¬ CrRPC.GetBulkDataSink[h, s];
};
[] ¬ EnumerateForInfo[h, pattern, info];
beginReturn[h];
};
FileInfoCaller:
PROC [h: CrRPC.Handle, s: CrRPC.
STREAM, beginReturn: CrRPC.BeginReturnProc] ~ {
name: ROPE;
wantedCreatedTime: INT32;
fullFName: ROPE;
bytes: INT32;
created: INT32;
{
name ¬ CrRPC.GetRope[s];
};
{
wantedCreatedTime ¬ CrRPC.GetInt32[s];
};
[fullFName, bytes, created] ¬ FileInfo[h, name, wantedCreatedTime];
beginReturn[h];
{
CrRPC.PutRope[s, fullFName];
};
{
CrRPC.PutInt32[s, bytes];
};
{
CrRPC.PutInt32[s, created];
};
};
AnyBodyHomeCaller:
PROC [h: CrRPC.Handle, s: CrRPC.
STREAM, beginReturn: CrRPC.BeginReturnProc] ~ {
mayBe: INT16;
[mayBe] ¬ AnyBodyHome[h];
beginReturn[h];
{
CrRPC.PutInt16[s, mayBe];
};
};
Server: CrRPC.ServerProc ~ {
[h: Handle, s: STREAM, pgm: CARD32, pgmVersion: CARD16, proc: CARD16, beginReturn: BeginReturnProc, beginError: BeginErrorProc, beginReject: BeginRejectProc]
ENABLE {
TrickleChargeP9813V411.FileNotFound => {
-- (6 )
beginError[h, 6 ];
CrRPC.PutRope[s, file];
GOTO Finished;
};
TrickleChargeP9813V411.Error => {
-- (5 )
beginError[h, 5 ];
CrRPC.PutRope[s, description];
GOTO Finished;
};
};
IF (pgmVersion # 411)
THEN {
beginReject[h, CrRPC.noSuchVersion];
CrRPC.PutCard16[s, 411]; --low
CrRPC.PutCard16[s, 411]; --high
RETURN
};
SELECT proc
FROM
3 => RetrieveCaller[h, s, beginReturn];
1 => EnumerateForInfoCaller[h, s, beginReturn];
2 => FileInfoCaller[h, s, beginReturn];
4 => AnyBodyHomeCaller[h, s, beginReturn];
ENDCASE => {
beginReject[h, CrRPC.noSuchProcedure];
};
EXITS
Finished => { NULL };
};
StopServer: CrRPC.StopServerQueryProc ~ { RETURN[FALSE] } ;
CrRPC.RegisterServerProcs[pgm~9813, pgmLoVersion~411, pgmHiVersion~ 411,
serverProc~Server, stopServerQueryProc~StopServer];
CrRPC.StartServerInstance[pgm~9813, pgmVersion~411, class~$CMUX];
start a second server thread
CrRPC.StartServerInstance[pgm~9813, pgmVersion~411, class~$CMUX];
}...