PFSCanonicalNames.mesa
Copyright Ó 1991 by Xerox Corporation. All rights reserved.
Carl Hauser, August 9, 1988 5:54:24 pm PDT
DIRECTORY
IO USING [STREAM],
PFSNames USING [Component, PATH, Version],
Rope USING [ROPE];
PFSCanonicalNames: CEDAR DEFINITIONS
SHARES PFSNames
~ BEGIN OPEN PFSNames;
ROPE: TYPE = Rope.ROPE;
UnparseName: PROC[name: PATH]
RETURNS [fullFName: ROPE];
Canonical unparsing:
[/]component0/component1/.../componentComponentCount-1[/]
The first / is included if name.absolute; the last if name.directory.
UnparseComponent: PROC [component: Component] RETURNS [ROPE];
Canonical unparsing:
Rope.Cat[name, Unparse[version]]
bug: name unparsing should insert escape characters on /, ! (and, of course, the escape character).
UnparseVersion: PUBLIC PROC [version: Version] RETURNS [ROPE];
Canonical unparsing:
NIL, !H, !L, !*, !num as appropriate.
ParseName: PROC [name: ROPE] RETURNS [parsedName: PATH];
Parsing names in canonical form.
ParseComponent: PROC [name: ROPE, first: NAT ¬ 0] RETURNS [component: Component, next: NAT];
parses a component beginning at name[first] and returns that component; next = first + length of the parsed component.
bug: should interpret escape sequences.
ParseVersion: PROC [v: ROPE, first: NAT ¬ 0] RETURNS [version: Version, next: NAT];
parses a version beginning at name[first] and returns that version; next = first + length of the parsed version.
ParseNameFromStream: PROC [s: IO.STREAM] RETURNS [name: PATH];
A convenient way to read a whitespace-delimited name from a stream.
END.