GvNsMap.mesa
Copyright Ó 1986, 1991 by Xerox Corporation. All rights reserved.
John Larson, May 26, 1986 5:25:02 pm PDT
Wes Irish, March 3, 1987 7:28:13 pm PST
Willie-s, December 27, 1991 2:22 pm PST
GvNsMap:
CEDAR
DEFINITIONS =
BEGIN
ROPE: TYPE = Rope.ROPE;
Syntax:
TYPE = {gv, ns, unknown};
Direction: TYPE = {gvToNs, nsToGv};
Stats:
TYPE =
RECORD [
lastUpdated: BasicTime.GMT,
troubleOnLastUpdate: BOOL ¬ FALSE,
updates: CARD ¬ 0,
gvToNsMaps: CARD ¬ 0,
nsToGvMaps: CARD ¬ 0,
gvToNs: CARD ¬ 0,
nsToGv: CARD ¬ 0
];
Direction controls which of the two mapping lists are used. gvToNs is the list with GV foreign registries and valid NS domains. nsToGv is the list with NS psuedo domains and valid GV registries. In all cases the returned ROPE will be NIL if no mapping is found.
DomainFromRegistry: PROC[reg: ROPE, dir: Direction ¬ gvToNs] RETURNS[domain: ROPE];
RegistryFromDomain: PROC[domain: ROPE, org: ROPE ¬ NIL, dir: Direction ¬ nsToGv] RETURNS[reg: ROPE];
If org is NIL then domain should really be "domain:org".
NsFromGvName: PROC[gvName: ROPE, dir: Direction ¬ gvToNs] RETURNS[nsName: ROPE];
GvFromNsName: PROC[nsName: ROPE, dir: Direction ¬ nsToGv] RETURNS[gvName: ROPE];
UpdateMap: PROC;
GetStats:
PROC
RETURNS [Stats];
SyntaxOf:
PROC[name:
ROPE]
RETURNS[syntax: Syntax];
Figure out what syntax this name is in. Should never return unknown.
NsSyntax:
PROC [name:
ROPE, inSyntax: Syntax ¬ unknown]
RETURNS [nsSyntax:
ROPE];
Returns the NS syntax for name
GvSyntax:
PROC [name:
ROPE, inSyntax: Syntax ¬ unknown, quoteIfNeeded:
BOOL ¬
TRUE]
RETURNS [gvSyntax:
ROPE];
Returns the GV syntax for name
If quoteIfNeeded then, if needed, wrap quotes around the name portion of the returning name -- this is usually what you want.
NativeSyntax:
PROC [name:
ROPE, inSyntax: Syntax ¬ unknown]
RETURNS [native:
ROPE, syntax: Syntax];
The incoming name can have the syntax of either world BUT it's native to one system and not the other. Fix up the syntax and indicate the native world via "syntax".
QuoteIfNeeded:
PROC [gvName:
ROPE]
RETURNS [
ROPE];
Puts quotes around the name portion of a GV name if needed (ie, there is a space in it and it's not already quoted)
BreakName:
PROC[name: Rope.
ROPE]
RETURNS[sn, reg: Rope.
ROPE];
Finds the last '. in name and returns the two parts; is no dot is found, sn is NIL and reg is name
END.