NSGetPutImpl.mesa
Please do not edit this file.
It was generated using CedarRPCGen.
DIRECTORY
Rope,
SunRPC,
NS,
NSGetPut;
NSGetPutImpl: CEDAR PROGRAM
IMPORTS SunRPC EXPORTS NS, NSGetPut =
BEGIN
Handle: TYPE = SunRPC.Handle;
ROPE: TYPE = Rope.ROPE;
ReturnCodesNames: PUBLIC ARRAY NS.ReturnCodes OF ROPE ← [
"Success",
"Unavailable",
"IllegalInsertPid",
"IllegalDeleteUid",
"IllegalFindSpec",
"ResourceFailure"
];
GetReturnCodes: PUBLIC PROC[h: Handle] RETURNS [res: NS.ReturnCodes] = {
res ← VAL[SunRPC.GetInt32[h]];
};
PutReturnCodes: PUBLIC PROC[h: Handle, in: NS.ReturnCodes] = {
SunRPC.PutInt32[h, ORD[in]];
};
DomainNames: PUBLIC ARRAY NS.Domain OF ROPE ← [
"localHost",
"localArea"
];
GetDomain: PUBLIC PROC[h: Handle] RETURNS [res: NS.Domain] = {
res ← VAL[SunRPC.GetInt32[h]];
};
PutDomain: PUBLIC PROC[h: Handle, in: NS.Domain] = {
SunRPC.PutInt32[h, ORD[in]];
};
GetString: PUBLIC PROC[h: Handle] RETURNS [res: NS.String] = {
res ← SunRPC.GetRope[h];
};
PutString: PUBLIC PROC[h: Handle, in: NS.String] = {
SunRPC.PutRope[h, in];
};
ValueTypeNames: PUBLIC ARRAY NS.ValueType OF ROPE ← [
"text",
"attributes",
"any"
];
GetValueType: PUBLIC PROC[h: Handle] RETURNS [res: NS.ValueType] = {
res ← VAL[SunRPC.GetInt32[h]];
};
PutValueType: PUBLIC PROC[h: Handle, in: NS.ValueType] = {
SunRPC.PutInt32[h, ORD[in]];
};
GetValue: PUBLIC PROC[h: Handle] RETURNS [res: NS.Value] = {
tag: NS.ValueType;
tag ← GetValueType[h];
SELECT tag FROM
text => {
v: REF text NS.ValueObject ← NEW[text NS.ValueObject];
v.valStr ← GetString[h];
res ← v;
};
attributes => {
v: REF attributes NS.ValueObject ← NEW[attributes NS.ValueObject];
{
len: INT ← SunRPC.GetInt32[h];
v.valPairs ← NEW[NS.SeqType0Object[len]];
FOR i: INT IN [0..len) DO
v.valPairs[i] ← GetAttribute[h];
ENDLOOP;
};
res ← v;
};
any => {
v: REF any NS.ValueObject ← NEW[any NS.ValueObject];
[] ← SunRPC.GetByte[h];
[] ← SunRPC.GetByte[h];
[] ← SunRPC.GetByte[h];
v.anyValue ← SunRPC.GetByte[h];
res ← v;
};
ENDCASE => NULL;
};
PutValue: PUBLIC PROC[h: Handle, in: NS.Value] = {
PutValueType[h, in.vType];
SELECT in.vType FROM
text => {
v: REF text NS.ValueObject ← NARROW[in];
PutString[h, v.valStr];
};
attributes => {
v: REF attributes NS.ValueObject ← NARROW[in];
SunRPC.PutInt32[h, v.valPairs.size];
FOR i: INT IN [0..v.valPairs.size) DO
PutAttribute[h, v.valPairs[i]];
ENDLOOP;
};
any => {
v: REF any NS.ValueObject ← NARROW[in];
SunRPC.PutInt32[h, v.anyValue];
};
ENDCASE => NULL;
};
GetAttribute: PUBLIC PROC[h: Handle] RETURNS [res: NS.Attribute] = {
res.name ← GetString[h];
res.value ← GetValue[h];
};
PutAttribute: PUBLIC PROC[h: Handle, in: NS.Attribute] = {
PutString[h, in.name];
PutValue[h, in.value];
};
GetObject: PUBLIC PROC[h: Handle] RETURNS [res: NS.Object] = {
{
len: INT ← SunRPC.GetInt32[h];
res ← NEW[NS.SeqType1Object[len]];
FOR i: INT IN [0..len) DO
res[i] ← GetAttribute[h];
ENDLOOP;
};
};
PutObject: PUBLIC PROC[h: Handle, in: NS.Object] = {
SunRPC.PutInt32[h, in.size];
FOR i: INT IN [0..in.size) DO
PutAttribute[h, in[i]];
ENDLOOP;
};
GetProjectionList: PUBLIC PROC[h: Handle] RETURNS [res: NS.ProjectionList] = {
{
len: INT ← SunRPC.GetInt32[h];
res ← NEW[NS.SeqType2Object[len]];
FOR i: INT IN [0..len) DO
res[i] ← GetString[h];
ENDLOOP;
};
};
PutProjectionList: PUBLIC PROC[h: Handle, in: NS.ProjectionList] = {
SunRPC.PutInt32[h, in.size];
FOR i: INT IN [0..in.size) DO
PutString[h, in[i]];
ENDLOOP;
};
GetProjectedObject: PUBLIC PROC[h: Handle] RETURNS [res: NS.ProjectedObject] = {
{
len: INT ← SunRPC.GetInt32[h];
res ← NEW[NS.SeqType3Object[len]];
FOR i: INT IN [0..len) DO
res[i] ← GetValue[h];
ENDLOOP;
};
};
PutProjectedObject: PUBLIC PROC[h: Handle, in: NS.ProjectedObject] = {
SunRPC.PutInt32[h, in.size];
FOR i: INT IN [0..in.size) DO
PutValue[h, in[i]];
ENDLOOP;
};
ProjectTypeNames: PUBLIC ARRAY NS.ProjectType OF ROPE ← [
"projected",
"complete"
];
GetProjectType: PUBLIC PROC[h: Handle] RETURNS [res: NS.ProjectType] = {
res ← VAL[SunRPC.GetInt32[h]];
};
PutProjectType: PUBLIC PROC[h: Handle, in: NS.ProjectType] = {
SunRPC.PutInt32[h, ORD[in]];
};
GetFoundObjects: PUBLIC PROC[h: Handle] RETURNS [res: NS.FoundObjects] = {
tag: NS.ProjectType;
tag ← GetProjectType[h];
SELECT tag FROM
projected => {
v: REF projected NS.FoundObjectsObject ← NEW[projected NS.FoundObjectsObject];
{
len: INT ← SunRPC.GetInt32[h];
v.projectedObjects ← NEW[NS.SeqType4Object[len]];
FOR i: INT IN [0..len) DO
v.projectedObjects[i] ← GetProjectedObject[h];
ENDLOOP;
};
res ← v;
};
complete => {
v: REF complete NS.FoundObjectsObject ← NEW[complete NS.FoundObjectsObject];
{
len: INT ← SunRPC.GetInt32[h];
v.objects ← NEW[NS.SeqType5Object[len]];
FOR i: INT IN [0..len) DO
v.objects[i] ← GetObject[h];
ENDLOOP;
};
res ← v;
};
ENDCASE => NULL;
};
PutFoundObjects: PUBLIC PROC[h: Handle, in: NS.FoundObjects] = {
PutProjectType[h, in.pType];
SELECT in.pType FROM
projected => {
v: REF projected NS.FoundObjectsObject ← NARROW[in];
SunRPC.PutInt32[h, v.projectedObjects.size];
FOR i: INT IN [0..v.projectedObjects.size) DO
PutProjectedObject[h, v.projectedObjects[i]];
ENDLOOP;
};
complete => {
v: REF complete NS.FoundObjectsObject ← NARROW[in];
SunRPC.PutInt32[h, v.objects.size];
FOR i: INT IN [0..v.objects.size) DO
PutObject[h, v.objects[i]];
ENDLOOP;
};
ENDCASE => NULL;
};
GetInsertargs: PUBLIC PROC[h: Handle] RETURNS [res: NS.Insertargs] = {
res.registrationKind ← GetString[h];
res.object ← GetObject[h];
res.pid ← SunRPC.GetInt32[h];
res.domain ← GetDomain[h];
};
PutInsertargs: PUBLIC PROC[h: Handle, in: NS.Insertargs] = {
PutString[h, in.registrationKind];
PutObject[h, in.object];
SunRPC.PutInt32[h, in.pid];
PutDomain[h, in.domain];
};
GetInsertreturn: PUBLIC PROC[h: Handle] RETURNS [res: NS.Insertreturn] = {
tag: NS.ReturnCodes;
tag ← GetReturnCodes[h];
SELECT tag FROM
Success => {
v: REF Success NS.InsertreturnObject ← NEW[Success NS.InsertreturnObject];
v.uid ← GetString[h];
res ← v;
};
ResourceFailure => {
v: REF ResourceFailure NS.InsertreturnObject ← NEW[ResourceFailure NS.InsertreturnObject];
res ← v;
};
IllegalFindSpec => {
v: REF IllegalFindSpec NS.InsertreturnObject ← NEW[IllegalFindSpec NS.InsertreturnObject];
res ← v;
};
IllegalDeleteUid => {
v: REF IllegalDeleteUid NS.InsertreturnObject ← NEW[IllegalDeleteUid NS.InsertreturnObject];
res ← v;
};
IllegalInsertPid => {
v: REF IllegalInsertPid NS.InsertreturnObject ← NEW[IllegalInsertPid NS.InsertreturnObject];
res ← v;
};
Unavailable => {
v: REF Unavailable NS.InsertreturnObject ← NEW[Unavailable NS.InsertreturnObject];
res ← v;
};
ENDCASE => NULL;
};
PutInsertreturn: PUBLIC PROC[h: Handle, in: NS.Insertreturn] = {
PutReturnCodes[h, in.returnCode];
SELECT in.returnCode FROM
Success => {
v: REF Success NS.InsertreturnObject ← NARROW[in];
PutString[h, v.uid];
};
ResourceFailure => {
v: REF ResourceFailure NS.InsertreturnObject ← NARROW[in];
};
IllegalFindSpec => {
v: REF IllegalFindSpec NS.InsertreturnObject ← NARROW[in];
};
IllegalDeleteUid => {
v: REF IllegalDeleteUid NS.InsertreturnObject ← NARROW[in];
};
IllegalInsertPid => {
v: REF IllegalInsertPid NS.InsertreturnObject ← NARROW[in];
};
Unavailable => {
v: REF Unavailable NS.InsertreturnObject ← NARROW[in];
};
ENDCASE => NULL;
};
GetDeleteargs: PUBLIC PROC[h: Handle] RETURNS [res: NS.Deleteargs] = {
res.uid ← GetString[h];
res.domain ← GetDomain[h];
};
PutDeleteargs: PUBLIC PROC[h: Handle, in: NS.Deleteargs] = {
PutString[h, in.uid];
PutDomain[h, in.domain];
};
GetReplaceargs: PUBLIC PROC[h: Handle] RETURNS [res: NS.Replaceargs] = {
res.registrationKind ← GetString[h];
res.object ← GetObject[h];
res.uid ← GetString[h];
res.domain ← GetDomain[h];
};
PutReplaceargs: PUBLIC PROC[h: Handle, in: NS.Replaceargs] = {
PutString[h, in.registrationKind];
PutObject[h, in.object];
PutString[h, in.uid];
PutDomain[h, in.domain];
};
GetFindargs: PUBLIC PROC[h: Handle] RETURNS [res: NS.Findargs] = {
res.patterns ← GetObject[h];
res.projection ← GetProjectionList[h];
res.domain ← GetDomain[h];
};
PutFindargs: PUBLIC PROC[h: Handle, in: NS.Findargs] = {
PutObject[h, in.patterns];
PutProjectionList[h, in.projection];
PutDomain[h, in.domain];
};
GetFindreturn: PUBLIC PROC[h: Handle] RETURNS [res: NS.Findreturn] = {
tag: NS.ReturnCodes;
tag ← GetReturnCodes[h];
SELECT tag FROM
Success => {
v: REF Success NS.FindreturnObject ← NEW[Success NS.FindreturnObject];
v.objects ← GetFoundObjects[h];
res ← v;
};
ResourceFailure => {
v: REF ResourceFailure NS.FindreturnObject ← NEW[ResourceFailure NS.FindreturnObject];
res ← v;
};
IllegalFindSpec => {
v: REF IllegalFindSpec NS.FindreturnObject ← NEW[IllegalFindSpec NS.FindreturnObject];
res ← v;
};
IllegalDeleteUid => {
v: REF IllegalDeleteUid NS.FindreturnObject ← NEW[IllegalDeleteUid NS.FindreturnObject];
res ← v;
};
IllegalInsertPid => {
v: REF IllegalInsertPid NS.FindreturnObject ← NEW[IllegalInsertPid NS.FindreturnObject];
res ← v;
};
Unavailable => {
v: REF Unavailable NS.FindreturnObject ← NEW[Unavailable NS.FindreturnObject];
res ← v;
};
ENDCASE => NULL;
};
PutFindreturn: PUBLIC PROC[h: Handle, in: NS.Findreturn] = {
PutReturnCodes[h, in.returnCode];
SELECT in.returnCode FROM
Success => {
v: REF Success NS.FindreturnObject ← NARROW[in];
PutFoundObjects[h, v.objects];
};
ResourceFailure => {
v: REF ResourceFailure NS.FindreturnObject ← NARROW[in];
};
IllegalFindSpec => {
v: REF IllegalFindSpec NS.FindreturnObject ← NARROW[in];
};
IllegalDeleteUid => {
v: REF IllegalDeleteUid NS.FindreturnObject ← NARROW[in];
};
IllegalInsertPid => {
v: REF IllegalInsertPid NS.FindreturnObject ← NARROW[in];
};
Unavailable => {
v: REF Unavailable NS.FindreturnObject ← NARROW[in];
};
ENDCASE => NULL;
};
END.