MSGetPutImpl.mesa
Please do not edit this file.
It was generated using CedarRPCGen.
DIRECTORY
Rope,
SunRPC,
MS,
MSGetPut;
MSGetPutImpl: CEDAR PROGRAM
IMPORTS SunRPC EXPORTS MS, MSGetPut =
BEGIN
Handle: TYPE = SunRPC.Handle;
ROPE: TYPE = Rope.ROPE;
ReturnCodesNames: PUBLIC ARRAY MS.ReturnCodes OF ROPE ← [
"Success",
"IllegalMaintainSpec",
"CouldntRunProgram",
"IllegalMaintainID"
];
GetReturnCodes: PUBLIC PROC[h: Handle] RETURNS [res: MS.ReturnCodes] = {
res ← VAL[SunRPC.GetInt32[h]];
};
PutReturnCodes: PUBLIC PROC[h: Handle, in: MS.ReturnCodes] = {
SunRPC.PutInt32[h, ORD[in]];
};
GetString: PUBLIC PROC[h: Handle] RETURNS [res: MS.String] = {
res ← SunRPC.GetRope[h];
};
PutString: PUBLIC PROC[h: Handle, in: MS.String] = {
SunRPC.PutRope[h, in];
};
GetMaintainargs: PUBLIC PROC[h: Handle] RETURNS [res: MS.Maintainargs] = {
res.idStr ← SunRPC.GetRope[h];
res.progName ← SunRPC.GetRope[h];
{
len: INT ← SunRPC.GetInt32[h];
res.progArgs ← NEW[MS.SeqType0Object[len]];
FOR i: INT IN [0..len) DO
res.progArgs[i] ← GetString[h];
ENDLOOP;
};
res.uid ← SunRPC.GetInt32[h];
res.pid ← SunRPC.GetInt32[h];
};
PutMaintainargs: PUBLIC PROC[h: Handle, in: MS.Maintainargs] = {
SunRPC.PutRope[h, in.idStr];
SunRPC.PutRope[h, in.progName];
SunRPC.PutInt32[h, in.progArgs.size];
FOR i: INT IN [0..in.progArgs.size) DO
PutString[h, in.progArgs[i]];
ENDLOOP;
SunRPC.PutInt32[h, in.uid];
SunRPC.PutInt32[h, in.pid];
};
GetMaintainreturn: PUBLIC PROC[h: Handle] RETURNS [res: MS.Maintainreturn] = {
tag: MS.ReturnCodes;
tag ← GetReturnCodes[h];
SELECT tag FROM
Success => {
v: REF Success MS.MaintainreturnObject ← NEW[Success MS.MaintainreturnObject];
v.pid ← SunRPC.GetInt32[h];
res ← v;
};
IllegalMaintainID => {
v: REF IllegalMaintainID MS.MaintainreturnObject ← NEW[IllegalMaintainID MS.MaintainreturnObject];
res ← v;
};
CouldntRunProgram => {
v: REF CouldntRunProgram MS.MaintainreturnObject ← NEW[CouldntRunProgram MS.MaintainreturnObject];
res ← v;
};
IllegalMaintainSpec => {
v: REF IllegalMaintainSpec MS.MaintainreturnObject ← NEW[IllegalMaintainSpec MS.MaintainreturnObject];
res ← v;
};
ENDCASE => NULL;
};
PutMaintainreturn: PUBLIC PROC[h: Handle, in: MS.Maintainreturn] = {
PutReturnCodes[h, in.returnCode];
SELECT in.returnCode FROM
Success => {
v: REF Success MS.MaintainreturnObject ← NARROW[in];
SunRPC.PutInt32[h, v.pid];
};
IllegalMaintainID => {
v: REF IllegalMaintainID MS.MaintainreturnObject ← NARROW[in];
};
CouldntRunProgram => {
v: REF CouldntRunProgram MS.MaintainreturnObject ← NARROW[in];
};
IllegalMaintainSpec => {
v: REF IllegalMaintainSpec MS.MaintainreturnObject ← NARROW[in];
};
ENDCASE => NULL;
};
GetUnmaintainargs: PUBLIC PROC[h: Handle] RETURNS [res: MS.Unmaintainargs] = {
res.idStr ← SunRPC.GetRope[h];
};
PutUnmaintainargs: PUBLIC PROC[h: Handle, in: MS.Unmaintainargs] = {
SunRPC.PutRope[h, in.idStr];
};
END.