1
0
mirror of synced 2026-05-12 10:11:19 +00:00
Files
Interlisp.medley/library/PSEUDOHOSTS.TEDIT

60 lines
10 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
Medley PSEUDOHOSTS
2
4
1
PSEUDOHOSTS
1
4
By Ron Kaplan
This document was last edited in April 2026.
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 referenced 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 CDSUFFIX NOERROR) [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. The pseudohost MEDLEY is set up in this way when the system is loaded.
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 the optional argument CDSUFFIX is provided, PSEUDOHOST evaluates (CDPSEUDO HOST CDSUFFIX) to construct a specialized cd command that makes it more convenient to connect to the pseudohost and its subdirectories. CDPSEUDO is described below.
if PREFIX cannot be resolved to a path on an existing file device, PSEUDOHOST will cause an error unless NOERROR.
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 appropriately 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.
(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. HOST may be provided as a host name (e.g. DSK), file device, file name, or stream.
(TARGETHOST HOST) [Function]
Returns the target host (e.g. DSK, UNIX) of a particular pseudohost, NIL if HOST is not a pseudohost.
(TRUEFILENAME FILE NOERROR) [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. If a true file name cannot be determined for FILE, TRUEFILENAME will return NIL if NOERROR, otherwise generate an error.
(TRUEDEVICE X) [Function]
Returns the true (target) file device for X, which may be a stream, a device, or the name of a file. If {MEDLEY} is a pseudohost on DSK, (TRUEDEVICE '{MEDLE}foo) will return the DSK file device. Causes an error if X itself cannot be coerced to a file device.
(PSEUDOFILENAME FILE PHOST) [Function]
Returns the name of FILE in a pseudo device, if any, essentially replacing a prefix of FILE 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.
The argument PHOST may be provided to resolve the ambiguity that arises if the prefix of one pseudohost is also a prefix of the prefix of another pseudohost. The default if PHOST is NIL is to choose the pseudohost that provides the shortest filename (i.e. the one with the longest prefix). If PHOST is one of the pseudohosts whose prefix is contained in FILE, that host is chosen even if the filename for that host is not the shortest.
(PSEUDOFILENAMES FILE) [Function]
Returns a list of all the pseudohosts for the true name of FILE.
(CDPSEUDO PHOST CDSUFFIX FILEPKGFLG) [Function]
Creates a cd command for connecting to the pseudohost PHOST and any of its subdirectories. For example, after executing (CDPSEUDO 'NOTECARDS 'n), the command cdn will connect to the top-level {NOTECARDS} directory, and cdn library will connect to {NOTECARDS}/library. The file package is not notified of the new command if FILEPKGFLG is NIL.
(SEQUENCE NIL NIL (0 0 0 0) ((PAGE NIL (PAPERSIZE Letter FOLIOINFO (ARABIC) STARTINGPAGE# 1) (0 0 612 792) ((FOLIO NIL (PARALOOKS (QUAD CENTERED) CHARLOOKS (SUPERSCRIPT 0 INVISIBLE OFF SELECTPOINT OFF PROTECTED OFF SIZE 10 FAMILY MODERN OVERLINE OFF STRIKEOUT OFF UNDERLINE OFF EXPANSION REGULAR SLOPE REGULAR WEIGHT MEDIUM INVERTED OFF USERINFO NIL STYLE NIL) FORMATINFO (ARABIC)) (174 36 288 36) NIL) (HEADING NIL (HEADINGTYPE RUNNINGHEAD) (84 744 528 36) NIL) (TEXT NIL NIL (84 96 456 600) NIL))) (ALTERNATE NIL NIL (0 0 0 0) ((PAGE NIL (PAPERSIZE Letter FOLIOINFO (ARABIC)) (0 0 612 792) ((FOLIO NIL (PARALOOKS (QUAD CENTERED) CHARLOOKS (SUPERSCRIPT 0 INVISIBLE OFF SELECTPOINT OFF PROTECTED OFF SIZE 10 FAMILY MODERN OVERLINE OFF STRIKEOUT OFF UNDERLINE OFF EXPANSION REGULAR SLOPE REGULAR WEIGHT MEDIUM INVERTED OFF USERINFO NIL STYLE NIL) FORMATINFO (ARABIC)) (174 36 288 36) NIL) (HEADING NIL (HEADINGTYPE RUNNINGHEAD) (84 744 528 36) NIL) (TEXT NIL NIL (84 96 456 600) NIL))) (PAGE NIL (PAPERSIZE Letter FOLIOINFO (ARABIC)) (0 0 612 792) ((FOLIO NIL (PARALOOKS (QUAD CENTERED) CHARLOOKS (SUPERSCRIPT 0 INVISIBLE OFF SELECTPOINT OFF PROTECTED OFF SIZE 10 FAMILY MODERN OVERLINE OFF STRIKEOUT OFF UNDERLINE OFF EXPANSION REGULAR SLOPE REGULAR WEIGHT MEDIUM INVERTED OFF USERINFO NIL STYLE NIL) FORMATINFO (ARABIC)) (174 36 288 36) NIL) (HEADING NIL (HEADINGTYPE RUNNINGHEAD) (84 744 528 36) NIL) (TEXT NIL NIL (84 96 456 600) NIL)))))))
1$4È$¨4È$¨4È$È1È$4È$¨4È $È4È$È4È$È1È$1ŠŠ8$1ŠŠ8$JÈ$È PAGEHEADING RUNNINGHEAD1TERMINAL(CHARPROPS (COLOR . BLACK))0CLASSIC
(CHARPROPS (COLOR . BLACK))/MODERN
(CHARPROPS (COLOR . BLACK))1TERMINAL(CHARPROPS (COLOR . BLACK))/MODERN (CHARPROPS (COLOR . BLACK))3
TIMESROMAN$(CHARPROPS (COLOR . BLACK))


 HRULE.GETFN  HRULE.GETFN  HRULE.GETFN   HRULE.GETFN  HRULE.GETFN
-g A 9' 3! I|
f) !#
\28©
 {`
Œ E!S  u"

 F<T'+m H ;h@
'3=lm
¨"A06=  9

(((CLEARGET) (CHARENCODING . MCCS)))PROPS:.DATE:k¹_içæzº