PFSCFSNames.mesa
Carl Hauser, April 18, 1989 5:01:04 pm PDT
DIRECTORY
IO USING [STREAM],
PFSNames USING [Component, PATH, Version],
Rope USING [ROPE];
PFSCFSNames: CEDAR DEFINITIONS
SHARES PFSNames
~ BEGIN OPEN PFSNames;
ROPE: TYPE = Rope.ROPE;
UnparseName: PROC[name: PATH]
RETURNS [fullFName: ROPE];
Cedar filename unparsing:
[component0]<component1>...>componentComponentCount-1[>]
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 Cedar filename 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.