Tuned init.lisp and pseudo.lisp to load pseudoscheme.

Pascal J. Bourguignon [2014-01-06 17:32]
Tuned init.lisp and pseudo.lisp to load pseudoscheme.
Filename
README
init.lisp
pseudo.lisp
diff --git a/README b/README
new file mode 100644
index 0000000..051ae9a
--- /dev/null
+++ b/README
@@ -0,0 +1,20 @@
+
+
+[pjb@kuiper :0.0 pseudo]$ clisp -ansi -norc -q
+[1]> (load"init.lisp")
+;; Loading file init.lisp ...
+;; Loaded file init.lisp
+#P"/home/pjb/src-lisp/implementations/pseudo/init.lisp"
+[2]> (scheme)
+;; Loading file /home/pjb/src-lisp/implementations/pseudo/pseudo.lisp ...
+;; …
+;; Loaded file /home/pjb/src-lisp/implementations/pseudo/pseudo.lisp
+This is Pseudoscheme 2.12.
+
+scheme[3]> ((if (= 1 2) car cdr) (cons 1 2))
+2
+scheme[4]> (quit)
+Leaving Pseudoscheme.
+
+[5]> (quit)
+[pjb@kuiper :0.0 pseudo]$
diff --git a/init.lisp b/init.lisp
index 903982d..2d8d007 100644
--- a/init.lisp
+++ b/init.lisp
@@ -1,19 +1,34 @@

-;;; Initialize logical hostnames:
+;;; Set up logical pathname translations:

-(setf (logical-pathname-translations "PACKAGES") (ignore-errors (logical-pathname-translations "PACKAGES"))
-      (logical-pathname-translations "LOADERS")  (ignore-errors (logical-pathname-translations "LOADERS")))
+(defun dirname (pathname)
+  (make-pathname :name nil :type nil :version nil :defaults pathname))

+(setf (logical-pathname-translations "PACKAGES")
+      (list* `("EDU;MIT;AI;PSEUDO;*.*.*"
+               ,(make-pathname :name :wild :type :wild :version :wild
+                               :defaults (merge-pathnames "pseudo/*.*" (dirname *load-truename*))))
+             `("EDU;MIT;AI;PSEUDO;*.*"
+               ,(make-pathname :name :wild :type :wild
+                               :defaults (merge-pathnames "pseudo/*.*" (dirname *load-truename*))))
+             `("EDU;MIT;AI;PSEUDO;*"
+               ,(make-pathname :name :wild
+                               :defaults (merge-pathnames "pseudo/*" (dirname *load-truename*))))
+             `("EDU;MIT;AI;PSEUDO;"
+               ,(merge-pathnames "pseudo/" (dirname *load-truename*)))
+             (ignore-errors (logical-pathname-translations "PACKAGES")))
+
+      (logical-pathname-translations "LOADERS")
+      (list* `("PSEUDO.*"
+               ,(make-pathname :name "pseudo" :type :wild
+                               :defaults (dirname *load-truename*)
+                               :case :local))
+             (ignore-errors (logical-pathname-translations "LOADERS"))))

-;;; Set up translations:

-(setf (logical-pathname-translations "PACKAGES") `((#P"PACKAGES:EDU;MIT;AI;PSEUDO;LOADIT.*"
-                                                      (merge-pathnames "pseudo/loadit.*" *load-pathname*)))
-      (logical-pathname-translations "LOADERS")  `((#P"LOADERS:PSEUDO.*"
-                                                      (merge-pathnames "pseudo.*" *load-pathname*))))

-;;; Define an autoload for scheme:

+;;; Define an autoload for scheme:

 (defmacro defautoload (name arguments loader)
   "Defines a function that will load the LOADER file, before calling itself again."
diff --git a/pseudo.lisp b/pseudo.lisp
index 4b8df71..f87943b 100644
--- a/pseudo.lisp
+++ b/pseudo.lisp
@@ -12,10 +12,9 @@
 (pushnew :unix *features*)

 (progn
-  (load (com.informatimago.tools.pathname:translate-logical-pathname #P"PACKAGES:EDU;MIT;AI;PSEUDO;LOADIT"))
-  (load-pseudoscheme (com.informatimago.tools.pathname:translate-logical-pathname #P"PACKAGES:EDU;MIT;AI;PSEUDO;")))
+  (load #P"PACKAGES:EDU;MIT;AI;PSEUDO;LOADIT.LISP")
+  (load-pseudoscheme #P"PACKAGES:EDU;MIT;AI;PSEUDO;"))

 (defun scheme () (ps:scheme))
-(format t "~2%Use: (scheme)~2%")

 ;;;; THE END ;;;;
ViewGit