SearchPathViewsDoc.tioga
Copyright Ó 1992 by Xerox Corporation. All rights reserved.
Last tweaked by Mike Spreitzer May 29, 1992 9:04 am PDT
SearchPathViews
CEDAR 10.1 FOR INTERNAL XEROX USE ONLY
SearchPathViews
PFS Views that search directories
Mike Spreitzer
Ó Copyright 1992 Xerox Corporation. All rights reserved.
Abstract: The SearchPath view is a PFS view that implements search paths.
Created by: Mike Spreitzer
Maintained by: Mike Spreitzer <Mike Spreitzer:PARC:Xerox>
Keywords: PFS View, Search Path, Union Directory
XEROX Xerox Corporation
Palo Alto Research Center
3333 Coyote Hill Road
Palo Alto, California 94304
For Internal Xerox Use Only
1. Search Path Directories
The SearchPath view is a PFS view that implements search paths. That is, it implements a new kind of directory, whose contents are effectively the union of the contents of several other directories. There are multiple, named search paths. A search path name is a ROPE modulo case. A search path is a non-empty sequence of directories. Creation of new files is done in the first directory in the sequence. Operations that involve finding an existing file search the directories, in order, to find an acceptable file.
A PFS path of the form `-SearchPath:/PathName' identifies one of these search path directories --- the one named PathName. There is a standard prefix mapping that maps `/path' to `-SearchPath:', so you can use `/path/PathName' equivalently to `-SearchPath:/PathName'.
A search path directory is case-sensitive iff one of the directories in its sequence is. If some of those directories are case-sensitive and others aren't, you may get incorrect or surprising results from some operations.
2. User Interface
There are a few Commander commands for manipulating search paths.
name SetPath
syntax
SetPath PathName read/write-dir read-dir*
description
Defines, or changes the definition of, a search path. The directory arguments may be relative (to the current directory), and need not be syntactic directories (eg, end with a slash).
examples
% SetPath foo bar baz
defines the path named `foo' to be the sequence <C/bar/ C/baz/>, where C is the current working directory.
% SetPath foo bar/ baz/
is exactly equivalent to the preceeding example.
% SetPath foo . ../../include
defines the path named `foo' to be the current working directory followed by the uncle named `include'.
warnings
No confirmation is printed, so be careful when using complex constructions.
stop/undo
The `DeletePath' command will un-define a search path name.
name GetPath
description
Prints the definition(s) of the given path name(s). The definition is printed as a command that would establish the definition.
examples
% GetPath foo
SetPath foo C/bar/ C/baz/
%
reveals the definition of the search path named `foo'.
% ls -bo /path/B*
/path/ base
-- 1 files
% GetPath base
SetPath base /tilde/spreitze/ubisrc/apps/base/ /tilde/spreitze/ubisrc/mob/
%
First a list of all defined search path names that begin with `B' is gotten with an `LS' invocation, then the definition of the only such one is queried. If only we could trick `LS' into omitting the directory, we could combine these two operations into one, which would look something like
% GetPath $(ls -therightswitches /path/B*)
name DeletePath
syntax
DeletePath PathName*
description
Removes the definition(s) of the given path name(s). For each given path name, an acknowledgment is printed, indicating whether the name had been defined.
examples
% DeletePath foo bar
Search path foo deleted.
Search path bar wasn't defined.
%
name InPath
syntax
InPath read/write-dir read-dir* DO cmd
description
Temporarily defines a new search path, and executes the given command with that path as the working directory. The name of the temporary search path does not appear in the command line, and will never be a name that was already defined. The search path name used is un-defined after the command is executed.
The level of quoting in cmd is not affected. Sadly, `$-interpretation' is done twice on cmd.
examples
% InPath . ../../mobs DO Mimosa -kc Foo
effectively adds a path-searching capability to Mimosa.
% InPath . DO echo -s "a b"
a b
%
Quotes in cmd are interpreted once.
% setprop foo ($bar)
% setprop bar "$baz"
% setprop baz barf
% echo $foo
$bar
% InPath . DO echo $foo
$baz
%
`$-interpretation' is done twice on cmd.
warnings
`$-interpretation' is done twice on cmd.
stop/undo
The STOP! button can stop the execution of cmd.
3. Programming Interface
See SearchPaths.mesa; it should be fairly self-explanatory, after reading the above material.