1
0
mirror of synced 2026-01-13 15:37:38 +00:00
Interlisp.medley/library/PSEUDOHOSTS.TEDIT
Frank Halasz 9dc408c81a
Expand the (PSEUDOHOSTS) function so that it can be used cleanly with RESETSAVE (#2154)
Expanded the (PSEUDOHOSTS) function to have an argument, which is a list of replacement pseudohost pair to replace the current list of pseudohosts.  Still returns the current list of pseudohosts as before.  Designed to be used cleanly with RESETSAVE.
2025-05-22 17:49:05 -07:00

52 lines
8.2 KiB
Plaintext
Raw Permalink 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 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 NEW.HOSTS) [Function]
Returns the (host prefix) pairs of all currently defined pseudohosts. If NEW.HOSTS is NIL, no other action is taken. If NEW.HOSTS is a list of (host prefix) pairs, then all of the current pseudohosts are removed and new pseudohosts are added by calling (PSEUDOHOST host prefix) on each pair in NEW.HOSTS. If NEW.HOSTS is T, then all current pseudohosts are simply removed. All other values of NEW.HOSTS result in an error. This function is designed to be used cleanly with RESETSAVE.
(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.
(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È$È4È$¨4È $È4È$È4È$È1È$1ŠŠ8$1ŠŠ8$JÈ$È PAGEHEADING RUNNINGHEADTERMINALGACHA
MODERN
MODERN 
TIMESROMAN$ 
  HRULE.GETFN
 HRULE.GETFN
 HRULE.GETFN   HRULE.GETFN
 HRULE.GETFN +g A 9&3! I|
f !#t8©
Œ E!{S  u"
 "U- Eí0p<4+m !5=kmDATE:iðÖ¡î®zº