Skip to content

Commit 9dc408c

Browse files
authored
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.
1 parent 330c5a0 commit 9dc408c

File tree

3 files changed

+38
-18
lines changed

3 files changed

+38
-18
lines changed

library/PSEUDOHOSTS

Lines changed: 38 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
(DEFINE-FILE-INFO PACKAGE "INTERLISP" READTABLE "INTERLISP" BASE 10)
22

3-
(FILECREATED "31-Dec-2024 11:45:23" {WMEDLEY}<library>PSEUDOHOSTS.;177 29713
3+
(FILECREATED "16-May-2025 12:07:44" {DSK}<home>frank>il>qmedley>library>PSEUDOHOSTS.;2 31408
44

5-
:EDIT-BY rmk
5+
:CHANGES-TO (FNS PSEUDOHOSTS)
66

7-
:CHANGES-TO (FNS TRUEDEVICE)
8-
9-
:PREVIOUS-DATE "25-Dec-2024 07:38:10" {WMEDLEY}<library>PSEUDOHOSTS.;176)
7+
:PREVIOUS-DATE "31-Dec-2024 11:45:23" {DSK}<home>frank>il>qmedley>library>PSEUDOHOSTS.;1)
108

119

1210
(PRETTYCOMPRINT PSEUDOHOSTSCOMS)
@@ -151,10 +149,32 @@
151149
DEV)))])
152150

153151
(PSEUDOHOSTS
154-
[LAMBDA NIL (* ; "Edited 17-Jan-2022 18:15 by rmk")
155-
(FOR DEV IN \FILEDEVICES WHEN (TYPE? FDEV (FETCH (PHDEVICE TARGETDEV) OF DEV))
156-
COLLECT (LIST (FETCH (FDEV DEVICENAME) OF DEV)
157-
(FETCH (PHDEVICE PREFIX) OF DEV])
152+
[LAMBDA (NEW.HOSTS) (* ; "Edited 17-Jan-2022 18:15 by rmk")
153+
(* ; "Edited 16-May-2025 9:16 by fgh")
154+
155+
(* ;; "")
156+
157+
(* ;; " Returns existing list of PSEUDOHOST pairs. If NEW.HOSTS is T, all current pseudohosts are removed by calling (PSEUDOHOST HOST NIL) on each current pseudohost in turn. Otherwise, NEW.HOSTS should be a list of (HOST PREFIX) pairs and all current pseudohosts are r(PSEUDOHOSTSemoved (as above) and the NEW.HOSTS pairs are used to create new pseudohosts by calling (PSEUDOHOST HOST PREFIX) sequentially in reverse order of the NEW.HOSTS list. Reverse order to ensure that (PSEUDOHOSTS (PSEUDOHOSTS)) doesn't impact the ordering in the PSEUDOHOST list. This function is designed to be used cleanly with RESETSAVE.")
158+
159+
(* ;; "")
160+
161+
(LET [(CURRENT.HOSTS (for DEV in \FILEDEVICES when (type? FDEV (fetch (PHDEVICE TARGETDEV)
162+
of DEV))
163+
collect (LIST (fetch (FDEV DEVICENAME) of DEV)
164+
(fetch (PHDEVICE PREFIX) of DEV]
165+
[COND
166+
((EQ NEW.HOSTS T)
167+
(for HOST in CURRENT.HOSTS do (PSEUDOHOST (CAR HOST)
168+
NIL)))
169+
[[AND (LISTP NEW.HOSTS)
170+
(for HOST in NEW.HOSTS always (AND (LISTP HOST)
171+
(NOT (CDDR HOST]
172+
(for HOST in CURRENT.HOSTS do (PSEUDOHOST (CAR HOST)
173+
NIL))
174+
(for HOST in (REVERSE NEW.HOSTS) do (PSEUDOHOST (CAR HOST)
175+
(CADR HOST]
176+
(NEW.HOSTS (ERROR (CONCAT "PSEUDOHOSTS: Argument not valid:" NEW.HOSTS]
177+
CURRENT.HOSTS])
158178

159179
(TARGETHOST
160180
[LAMBDA (HOST) (* ; "Edited 14-Dec-2024 15:26 by rmk")
@@ -562,13 +582,13 @@
562582
EXPORTS.ALL)
563583
)
564584
(DECLARE%: DONTCOPY
565-
(FILEMAP (NIL (1318 12059 (PSEUDOHOST 1328 . 7036) (PSEUDOHOSTP 7038 . 7867) (PSEUDOHOSTS 7869 . 8230)
566-
(TARGETHOST 8232 . 9101) (TRUEDEVICE 9103 . 10059) (TRUEFILENAME 10061 . 11186) (PSEUDOFILENAME 11188
567-
. 12057)) (12087 18102 (EXPAND.PH 12097 . 13350) (CONTRACT.PH 13352 . 16063) (UNSLASHIT 16065 . 17811
568-
) (GETHOSTINFO.PH 17813 . 18100)) (18103 19004 (CDPSEUDO 18113 . 19002)) (19005 27025 (OPENFILE.PH
569-
19015 . 20088) (GETFILENAME.PH 20090 . 20379) (DIRECTORYNAMEP.PH 20381 . 21005) (CLOSEFILE.PH 21007 .
570-
21474) (REOPENFILE.PH 21476 . 22041) (DELETEFILE.PH 22043 . 22327) (OPENP.PH 22329 . 22624) (
571-
UNREGISTERFILE.PH 22626 . 23168) (REGISTERFILE.PH 23170 . 23704) (GENERATEFILES.PH 23706 . 24750) (
572-
GETFILEINFO.PH 24752 . 25054) (SETFILEINFO.PH 25056 . 25255) (NEXTFILEFN.PH 25257 . 25803) (
573-
FILEINFOFN.PH 25805 . 26080) (RENAMEFILE.PH 26082 . 27023)))))
585+
(FILEMAP (NIL (1331 13754 (PSEUDOHOST 1341 . 7049) (PSEUDOHOSTP 7051 . 7880) (PSEUDOHOSTS 7882 . 9925)
586+
(TARGETHOST 9927 . 10796) (TRUEDEVICE 10798 . 11754) (TRUEFILENAME 11756 . 12881) (PSEUDOFILENAME
587+
12883 . 13752)) (13782 19797 (EXPAND.PH 13792 . 15045) (CONTRACT.PH 15047 . 17758) (UNSLASHIT 17760 .
588+
19506) (GETHOSTINFO.PH 19508 . 19795)) (19798 20699 (CDPSEUDO 19808 . 20697)) (20700 28720 (
589+
OPENFILE.PH 20710 . 21783) (GETFILENAME.PH 21785 . 22074) (DIRECTORYNAMEP.PH 22076 . 22700) (
590+
CLOSEFILE.PH 22702 . 23169) (REOPENFILE.PH 23171 . 23736) (DELETEFILE.PH 23738 . 24022) (OPENP.PH
591+
24024 . 24319) (UNREGISTERFILE.PH 24321 . 24863) (REGISTERFILE.PH 24865 . 25399) (GENERATEFILES.PH
592+
25401 . 26445) (GETFILEINFO.PH 26447 . 26749) (SETFILEINFO.PH 26751 . 26950) (NEXTFILEFN.PH 26952 .
593+
27498) (FILEINFOFN.PH 27500 . 27775) (RENAMEFILE.PH 27777 . 28718)))))
574594
STOP

library/PSEUDOHOSTS.LCOM

318 Bytes
Binary file not shown.

library/PSEUDOHOSTS.TEDIT

441 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)