Subject: [clisp-list] how do i make clisp compile to a parallel directory hierarchy?

From: Christian Schuhegger <[email-masked]>
Date: Wed Mar 27 08:59:07 2002

hello all,

i would like to make clisp compile to a parallel directory hierarchy
(parallel to my src hierarchy). when i use "clisp -c source-file -o
out-file " this works fine, but all the files included via "require" get
compiled in the src hierarchy. is there a way to make clisp compile
these files and put them also into the parallel hierarchy?

many thanks for any hints.

--
Christian Schuhegger

---

From: Sam Steingold <[email-masked]>
Date: Wed Mar 27 13:41:03 2002

> * In message <[email-masked]>
> * On the subject of "[clisp-list] how do i make clisp compile to a parallel directory hierarchy?"
> * Sent on Wed, 27 Mar 2002 17:58:42 +0100
> * Honorable Christian Schuhegger <[email-masked]> writes:
>
> out-file " this works fine, but all the files included via "require"
> get compiled in the src hierarchy. is there a way to make clisp
> compile these files and put them also into the parallel hierarchy?

"this would be hard to construe as a feature" (L.Wall).

Please try the appended patch.
(Everyone who relies on REQUIRE should try it!)

thanks!

-- 
Sam Steingold (http://www.podval.org/~sds) running RedHat7.2 GNU/Linux
Keep Jerusalem united! <http://www.onejerusalem.org/Petition.asp>
Read, think and remember! <http://www.iris.org.il> <http://www.memri.org/>
A man paints with his brains and not with his hands.

--- compiler.lisp.~1.76.~	Thu Mar 21 20:23:05 2002
+++ compiler.lisp	Wed Mar 27 16:35:00 2002
@@ -242,6 +242,7 @@
 (defvar *compiling-from-file*) ; NIL or T if called by COMPILE-FILE
 (defvar *compile-file-pathname* nil) ; CLtL2 p. 680
 (defvar *compile-file-truename* nil) ; CLtL2 p. 680
+(defvar *compile-file-directory* nil) ; for c-REQUIRE
 (defvar *compile-file-lineno1* nil)
 (defvar *compile-file-lineno2* nil)
 (defvar *c-listing-output*) ; Compiler-Listing-Stream or nil
@@ -4309,7 +4310,16 @@
                (if (and (consp present-files)
                         (string= (pathname-type newest-file) "lib"))
                  (load newest-file :verbose nil :print nil :echo nil) ; load libfile
-                 (compile-file (or newest-file file)))))) ; compile file
+                 (let ((fi (or newest-file file)))
+                   (if  *compile-file-directory*
+                     ;; `compile-file' was called without an explicit
+                     ;; :output-file arg, so compile `in place'
+                     (compile-file fi)
+                     ;; `compile-file' was given :output-file,
+                     ;; so put the compiled file there
+                     (compile-file fi :output-file
+                                   (merge-pathnames *compile-file-directory*
+                                                    fi))))))))
       (if (atom pathname) (load-lib pathname) (mapcar #'load-lib pathname)))))
 
 ;;; auxiliary functions for
@@ -11332,6 +11342,10 @@
                                ((:verbose *compile-verbose*) *compile-verbose*)
                                ((:print *compile-print*) *compile-print*)
                           &aux liboutput-file (*coutput-file* nil)
+                               (*compile-file-directory*
+                                (if (eq t output-file) nil
+                                    (make-pathname :name nil :type nil
+                                                   :defaults output-file)))
                                (new-output-stream nil)
                                (new-listing-stream nil))
   (multiple-value-setq (output-file file)

---

From: Sam Steingold <[email-masked]>
Date: Thu Mar 28 16:03:03 2002

> * In message <[email-masked]>
> * On the subject of "Re: [clisp-list] how do i make clisp compile to a parallel directory  hierarchy?"
> * Sent on Thu, 28 Mar 2002 16:57:23 +0100
> Sam Steingold wrote:

did anyone else test it?

> there is a bug:
> this should be:
> > +                   (if  (not *compile-file-directory*)
thanks.

> and then it works, but only partially.

you want a full-blown system management.  REQUIRE ain't that.

PS. please do not move this into private e-mail.

-- 
Sam Steingold (http://www.podval.org/~sds) running RedHat7.2 GNU/Linux
Keep Jerusalem united! <http://www.onejerusalem.org/Petition.asp>
Read, think and remember! <http://www.iris.org.il> <http://www.memri.org/>
PI seconds is a nanocentury