NameFromRope:
PUBLIC
PROC [rope:
ROPE,
defaultDomain:
ROPE ¬
NIL, defaultOrganization:
ROPE ¬
NIL]
RETURNS [name: Name] ~ {
pos1, pos2, pos3, len: INT;
len1, len2, len3: INT ¬ 0;
len ¬ Rope.Length[rope];
pos1 ¬ 0;
{
len1 ¬ Rope.Index[s1~rope, pos1~pos1, s2~":"];
pos2 ¬ len1 + 1;
pos3 ¬ pos2 + 1;
IF len1 > maxObjectLength
THEN {
SIGNAL FieldTooLong[1];
len1 ¬ maxObjectLength };
};
name.object ¬ Rope.Substr[base~rope, start~pos1, len~len1];
IF pos2 <= len
THEN {
pos3 ¬ Rope.Index[s1~rope, pos1~pos2, s2~":"];
len2 ¬ pos3 - pos2;
pos3 ¬ pos3 + 1;
IF len2 > maxDomainLength
THEN {
SIGNAL FieldTooLong[2];
len2 ¬ maxDomainLength };
};
IF len2 > 0
THEN name.domain ¬ Rope.Substr[base~rope, start~pos2, len~len2]
ELSE name.domain ¬ GetDefaultDomain[defaultDomain];
IF pos3 <= len
THEN {
len3 ¬ len - pos3;
IF len3 > maxOrganizationLength
THEN {
SIGNAL FieldTooLong[3];
len3 ¬ maxOrganizationLength;
};
};
IF len3 > 0
THEN name.organization ¬ Rope.Substr[base~rope, start~pos3, len~len3]
ELSE name.organization ¬ GetDefaultOrganization[defaultOrganization];
};
DomainNameFromRope:
PUBLIC
PROC [rope:
ROPE,
defaultDomain:
ROPE ¬
NIL, defaultOrganization:
ROPE ¬
NIL]
RETURNS [domainName: DomainName] ~ {
pos2, pos3, len: INT;
len2, len3: INT ¬ 0;
len ¬ Rope.Length[rope];
pos2 ¬ 0;
{
len2 ¬ Rope.Index[s1~rope, pos1~pos2, s2~":"];
pos3 ¬ len2 + 1;
IF len2 > maxDomainLength
THEN {
SIGNAL FieldTooLong[2];
len2 ¬ maxDomainLength };
};
IF len2 > 0
THEN domainName.domain ¬ Rope.Substr[base~rope, start~pos2, len~len2]
ELSE domainName.domain ¬ GetDefaultDomain[defaultDomain];
IF pos3 <= len
THEN {
len3 ¬ len - pos3;
IF len3 > maxOrganizationLength
THEN {
SIGNAL FieldTooLong[3];
len3 ¬ maxOrganizationLength;
};
};
IF len3 > 0
THEN domainName.organization ¬ Rope.Substr[base~rope, start~pos3, len~len3]
ELSE domainName.organization ¬ GetDefaultOrganization[defaultOrganization];
};
RopeFromName:
PUBLIC
PROC [name: Name]
RETURNS [rope:
ROPE] ~ {
rope ¬ Rope.Cat[name.object, ":", name.domain, ":", name.organization];
};
RopeFromDomainName:
PUBLIC
PROC [domainName: DomainName]
RETURNS [rope:
ROPE] ~ {
rope ¬ Rope.Cat[domainName.domain, ":", domainName.organization];
};
}...