* PSEUDHOSTS and .TEDIT: Apply TRUEFILENAME on PREFIX, update documentation Documentation addresses #1303 . Using TRUEFILENAME makes sure it always goes to a ground instance in e.g. (PSEUDOHOST 'MEDLEY '{MEDLEY}). * PSEUDOHOSTS.LCOM and .TEDIT Appear to have gotten out of step
40 lines
7.8 KiB
Plaintext
40 lines
7.8 KiB
Plaintext
Medley PSEUDOHOSTS
|
||
2
|
||
|
||
4
|
||
|
||
1
|
||
|
||
PSEUDOHOSTS
|
||
1
|
||
|
||
4
|
||
|
||
By Ron Kaplan
|
||
This document was created in January 2022.
|
||
|
||
A pseudohost identifies the root of a file system that exists as a subdirectory of another pre-existing file system. This gives a shorthand way of operating on a file in the subdirectory of a particular project without having to specify in the name of that file the entire path to its location in a larger file system. For example, suppose that the variable MEDLEYDIR contains the path from {DSK} to the subdirectory that contains all Medley system files (e.g. {DSK}<Users>kaplan>Local>medley>). If not connected to that subdirectory, then the file COREIO, say, would have to be reference as
|
||
{DSK}<Users>kaplan>Local>medley>sources>COREIO.
|
||
If MEDLEY is defined as a pseudohost with MEDLEYDIR as its prefix, then that file can also be identified more succinctly as {MEDLEY}<sources>COREIO.
|
||
This package implements pseudohost file devices that allow files to be specified and manipulated in this way. The function PSEUDOHOST defines a new pseudohost whose files coincide with the files at the end of a prefix directory path:
|
||
(PSEUDOHOST HOST PREFIX) [Function]
|
||
For the Medley example, executingÿ
|
||
(PSEUDOHOST 'MEDLEY MEDLEYDIR)
|
||
will set up MEDLEY as a (pseudo) host name that can be used to reference Medley system files. As another example,
|
||
(PSEUDOHOST 'NC "{DSK}<Users>kaplan>Local>notecards>"
|
||
would provide a shorthand {NC} for accessing the files that make up the Notecards application. Note that the prefix is always interpreted as a directory path, whether or not it ends with an explicit > or /.
|
||
If PSEUDOHOST is called with the name of a previously defined pseudohost but with a different prefix, the new prefix replaces the old. If the prefix is NIL, the pseudohost is removed. If HOST is a list and PREFIX is NIL, HOST is interpreted as a (host prefix) pair. The target host defaults to DSK if PREFIX does not have an explicit host.
|
||
Of course, full filenames can continue to be used for file access--the pseudohost just provides a systematic abbreviated naming convention. Apart from this convenience, a further advantage is that pseudohost file designators will remain valid if directories are relocated or even moved to different machines, provided that the pseudohost is redefined for the new environment.
|
||
Pseudohosts can be used wherever hosts or directories are normally specified. Thus (CNDIR '{MEDLEY} or cd {MEDLEY} will connect to the underlying MEDLEYDIR directory, but the shorter pseudohost will appear in the file and path names returned by the usual system functions (INFILEP, DIRECTORYNAME, FB *,...). When connected to {MEDLEY}<sources>, (INFILEP 'FILEPKG) will return {MEDLEY}<sources>FILEPKG.
|
||
When PSEUDOHOSTS is loaded, it executes
|
||
(PSEUDOHOST 'LI LOGINHOSTDIR)
|
||
so that files in the login directory can always be referenced succinctly with host {LI}, even while connected to another directory.
|
||
(PSEUDOHOSTS) [Function]
|
||
Returns the (host prefix) pairs of all currently defined pseudohosts.
|
||
(PSEUDOHOSTP HOST) [Function]
|
||
Returns the (host prefix) pair for a particular pseudohost, NIL if HOST is not a pseudohost.
|
||
(TARGETHOST HOST) [Function]
|
||
Returns the target host of a particular pseudohost, NIL if HOST is not a pseudohost.
|
||
(TRUEFILENAME FILE) [Function]
|
||
Returns the name of FILE in its true device, essentially replacing FILE's host by its prefix if it is a pseudohost. Returns FILE (possibly extended with the prefix of the connected directory) if its host is not a pseudohost. FILE may be a stream as well as a name. It may also be a list, in which case the value is the result of applying TRUEFILENAME to each of its elements.
|
||
(PSEUDOFILENAME FILE) [Function]
|
||
Returns the name of FILE in its pseudo device, if any, essentially replacing FILE's prefix by the hostname of a pseudodevice for that prefix. Returns FILE (possibly extended with the prefix of the connected directory) if it does not match a pseudohost prefix. FILE may be a stream as well as a name. It may also be a list, in which case the value is the result of applying PSEUDOFILENAME to each of its elements.
|
||
|
||
|
||
|
||
|