Re: [asdf-devel] ASDF with RMCL?

"Chun Tian (binghe)" <[email protected]> Fri, 21 Jan 2011 02:32:15 +0800
Newsgroups gmane.lisp.mcl.general
Message-ID <7EB4EE31-4F12-494E-A2E6-98AA3FBE3127__24849.5983695195$1295548384$gmane$org@gmail.com>
Hi, Pascal

I took some time for this. It seems that the only problem is in function "getenv":

(defun* getenv (x)
  (#+(or abcl clisp) ext:getenv
   #+allegro sys:getenv
   #+clozure ccl:getenv
   #+(or cmu scl) (lambda (x) (cdr (assoc x ext:*environment-list* :test #'string=)))
   #+ecl si:getenv
   #+gcl system:getenv
   #+lispworks lispworks:environment-variable
   #+sbcl sb-ext:posix-getenv
   x))

This function need to support MCL/RMCL. I couldn't find a exist function to get environment variables, so I wrote one using MCL's FFI (define-entry-point):

#+mcl
(eval-when (:compile-toplevel :load-toplevel :execute)
  (ccl:define-entry-point (_getenv "getenv") ((name :string)) :string))

#+mcl
(defun %getenv (x)
  (ccl:with-cstrs ((name x))
    (let ((value (_getenv name)))
      (unless (ccl:%null-ptr-p value)
	(ccl:%get-cstring value)))))

(If any MCL guru could tell me a easier way to do the same thing, glad to learn it)

Any way, attached patch should fix ASDF 2 on MCL/RMCL, and I do successfully load at least one ASDF system in MCL/ASDF2.

Please confirm my patch.

Regards,

Chun Tian (binghe)



> 
> On 20 Jan 2011, at 14:26, Faré wrote:
> 
>> On 20 January 2011 06:49, Pascal Costanza <[email protected]> wrote:
>>> It seems that ASDF 2.x doesn't work with RMCL (ASDF 1.x did). Is that a known issue?
>>> 
>> What is RMCL? Digitool's MCL? It might very well have bitrotten,
>> since I don't think anyone has tried it since we started working on ASDF 2.
>> I certainly don't have access to a machine capable of running it.
> 
> RMCL is being maintained, is available from http://code.google.com/p/mcl/ and runs on current Mac OS X versions. (This is just for information, not a hidden attempt to convince anyone to do the work to make ASDF 2 support it.)
> 
>> Look for places with #+clozure, and test the functions individually,
>> making sure you have proper code with #+digitool. Also, some places
>> may incorrectly be using #+ccl where #+clozure is meant, and even
>> where it works, it is probably better to use #+(or clozure digitool).
>> 
>> I would be particularly wary of functions created in recent refactorings,
>> such as SUBDIRECTORIES.
>> 
>> If you get it to work, please provide a patch, which I will apply.
>> Also, it is nice if you can run the test suite.
> 
> I'll see what I can do, but cannot promise anything for the short run.
> 
> Thanks for the quick response!
> 
> 
> Pascal

_______________________________________________
info-mcl mailing list
[email protected]
http://clozure.com/mailman/listinfo/info-mcl
asdf2-mcl.diff (application/octet-stream, 766 B)
diff --git a/asdf.lisp b/asdf.lisp
index 3d2fce9..57ba661 100644
--- a/asdf.lisp
+++ b/asdf.lisp
@@ -558,6 +558,17 @@ pathnames."
     :unless (eq k key)
     :append (list k v)))
 
+#+mcl
+(eval-when (:compile-toplevel :load-toplevel :execute)
+  (ccl:define-entry-point (_getenv "getenv") ((name :string)) :string))
+
+#+mcl
+(defun* %getenv (x)
+  (ccl:with-cstrs ((name x))
+    (let ((value (_getenv name)))
+      (unless (ccl:%null-ptr-p value)
+	(ccl:%get-cstring value)))))
+
 (defun* getenv (x)
   (#+(or abcl clisp) ext:getenv
    #+allegro sys:getenv
@@ -567,6 +578,7 @@ pathnames."
    #+gcl system:getenv
    #+lispworks lispworks:environment-variable
    #+sbcl sb-ext:posix-getenv
+   #+mcl %getenv
    x))
 
 (defun* directory-pathname-p (pathname)