From a6b9010dcb6eacee20301e14b8d43c4bf548ab79 Mon Sep 17 00:00:00 2001
From: Liam Healy <liam@thinkpad.local>
Date: Sun, 28 Dec 2008 00:30:14 -0500
Subject: [PATCH] Fix for non-native implementations; some documentation update

Fixed several errors that only were present for #-native
implementations (i.e. not SBCL).  It is not yet complete for
non-native arrays.  It now compiles completely in CLISP
but crashes immediately with a SIGSEGV on amd64 platforms.  This is
apparently due to this bug:
http://sourceforge.net/tracker/?func=detail&atid=101355&aid=2292928&group_id=1355
---
 data/foreign-friendly.lisp | 15 +--------------
 data/maref.lisp            |  4 ++--
 data/marray.lisp           |  6 ++----
 documentation/index.html   | 34 ++++++++++++++++++++++------------
 init/conditions.lisp       |  8 ++++----
 init/defmfun.lisp          |  8 +++++---
 6 files changed, 36 insertions(+), 39 deletions(-)

diff --git a/data/foreign-friendly.lisp b/data/foreign-friendly.lisp
index 6d647c89..e1a590bf 100644
--- a/data/foreign-friendly.lisp
+++ b/data/foreign-friendly.lisp
@@ -1,6 +1,6 @@
 ;; Use the foreign-friendly arrays package.
 ;; Liam Healy 2008-03-22 15:40:08EDT
-;; Time-stamp: <2008-12-27 10:23:27EST foreign-friendly.lisp>
+;; Time-stamp: <2008-12-27 17:54:24EST foreign-friendly.lisp>
 ;; $Id$
 
 ;;; Foreign-friendly arrays (original implementation by Tamas Papp)
@@ -125,19 +125,6 @@
 ;;;; Pointer management
 ;;;;****************************************************************************
 
-#+native
-(defmacro with-pointer-to-array ((array pointer cffi-type length)
-				 &body body)
-  (assert (symbolp pointer))
-  (once-only (array cffi-type)
-    (with-unique-names (original-array index-offset)
-      `(multiple-value-bind (,original-array ,index-offset)
-	   (find-original-array ,array)
-	 (pin-to-pointer (,original-array ,pointer ,cffi-type
-					  ,length ,index-offset)
-	   ,@body)))))
-
-
 #+native
 (defmacro with-pointer-to-array ((array pointer cffi-type length)
 				 &body body)
diff --git a/data/maref.lisp b/data/maref.lisp
index d0dbc40b..0e4b75db 100644
--- a/data/maref.lisp
+++ b/data/maref.lisp
@@ -1,6 +1,6 @@
 ;; Get/set array or elements: cl-array, maref
 ;; Liam Healy 2008-08-27 22:43:10EDT maref.lisp
-;; Time-stamp: <2008-12-26 10:25:50EST maref.lisp>
+;; Time-stamp: <2008-12-27 17:07:28EST maref.lisp>
 ;; $Id: $
 
 (in-package :gsl)
@@ -101,7 +101,7 @@
     (if index2
 	(setf (aref (slot-value object 'cl-array) index index2) value)
 	(setf (aref (slot-value object 'cl-array) index) value))
-    #-native (setf c-invalid t))
+    #-native (setf (c-invalid object) t))
   (:method (value (object array) index &optional index2 type)
     ;; For compatibility, work on CL arrays as well.
     (declare (ignore type))
diff --git a/data/marray.lisp b/data/marray.lisp
index 0b64e479..6c06b9a9 100644
--- a/data/marray.lisp
+++ b/data/marray.lisp
@@ -1,6 +1,6 @@
 ;; A "marray" is an array in both GSL and CL
 ;; Liam Healy 2008-04-06 21:23:41EDT
-;; Time-stamp: <2008-12-26 12:49:10EST marray.lisp>
+;; Time-stamp: <2008-12-27 16:54:11EST marray.lisp>
 ;; $Id$
 
 (in-package :gsl)
@@ -193,7 +193,6 @@
      (cl-array object)
      (c-pointer object)
      (component-type (element-type object))
-     (element-type object)
      0
      (component-size object))
     (setf (c-invalid object) nil)))
@@ -207,10 +206,9 @@
      (cl-array object)
      (c-pointer object)
      (component-type (element-type object))
-     (element-type object)
      0
      (component-size object))
-    (setf cl-invalid nil)))
+    (setf (cl-invalid object) nil)))
 
 #-native
 (defun copy-array-to-pointer (array pointer lisp-type index-offset length)
diff --git a/documentation/index.html b/documentation/index.html
index d8816fc4..44c14972 100644
--- a/documentation/index.html
+++ b/documentation/index.html
@@ -75,10 +75,8 @@ Input domain error |m| > 1.0 in elljac.c at line 46
 
 <h3>Requirements and Platforms</h3>
  <div class="content">
-  <p> GSLL should work in
-      any Common Lisp implementation and platform combination
-      that has <a href="http://common-lisp.net/project/cffi/">CFFI</a>
-       with callbacks and foreign-funcall support.  You will need
+  <p> GSLL should work in any Common Lisp implementation and platform combination
+      for which the following are supported:
       </p>
         <ul>
         <li><a href="http://www.gnu.org/software/gsl/">GSL</a></li>
@@ -86,7 +84,10 @@ Input domain error |m| > 1.0 in elljac.c at line 46
 	  (Version 0.10.0 or newer,
 	  or <a href="http://packages.debian.org/lenny/cl-cffi">the
 	  version in Debian/lenny</a>)
+	  Only platforms and implementations which have callbacks and
+	  foreign-funcall support will work.
 	</li>
+	<li><a href="http://www.cliki.net/trivial-garbage">trivial-garbage</a>
         <li><a href="http://common-lisp.net/project/cl-utilities/">cl-utilities</a>
 	  </li>
         <li><a href="http://www.cliki.net/asdf">ASDF</a></li>
@@ -94,10 +95,12 @@ Input domain error |m| > 1.0 in elljac.c at line 46
       <p>
         In <a href="http://www.debian.org">Debian</a> Lenny (5.0) or newer,
         the following should work:</p>
-      <blockquote><pre>aptitude install <a
-        href="http://packages.debian.org/lenny/libgsl0ldbl">libgsl0ldbl</a> <a href="http://packages.debian.org/lenny/cl-cffi">cl-cffi</a></pre></blockquote>
-      (asdf is automatically installed with your CL implementation).
-      Once your CL implementation is running, do
+<blockquote><pre>
+aptitude install <a href="http://packages.debian.org/lenny/libgsl0ldbl">libgsl0ldbl</a> <a href="http://packages.debian.org/lenny/cl-cffi">cl-cffi</a>
+</pre></blockquote>
+        and you will need to manually download and install
+        trivial-garbage; ASDF is automatically installed with your CL
+        implementation.  Once your CL implementation is running, do
       <code>(asdf:operate 'asdf:compile-op :gsll)</code> 
       or, if using Debian with the
       <a href="http://packages.debian.org/common-lisp-controller">
@@ -105,14 +108,21 @@ Input domain error |m| > 1.0 in elljac.c at line 46
         <code>clc-register-user-package</code> and then within Lisp
       <code>(clc:clc-require :gsll)</code>.
   <p>GSLL has been tested with <a
- href="http://sbcl.sourceforge.net/">SBCL</a> and <a
- href="http://clisp.cons.org/">CLISP</a> on Debian i386 and amd64.</p>
+ href="http://sbcl.sourceforge.net/">SBCL</a> on Debian amd64.</p>
  </div>
 
  <h3>Downloads</h3>
  <div class="content">
- <p>You may browse or download as follows:</p>
+ <p>See <a href="http://repo.or.cz/w/gsll.git">the official
+ repository</a> to browse or download.  To clone:
+<pre>
+git clone git://repo.or.cz/gsll.git
+</pre>
+To retrieve a compressed tarball, click one of the "snapshot" links on
+the repository web page.
+ </p>
  <ul>
+   
  </ul>
  </div>
  
@@ -143,7 +153,7 @@ Input domain error |m| > 1.0 in elljac.c at line 46
 <!-- Created: Feb 25 2005 -->
 <!-- hhmts start -->
     <small>
-       Time-stamp: <2008-11-16 15:35:22EST index.html>
+       Time-stamp: <2008-12-27 14:33:37EST index.html>
        </small>
 <!-- hhmts end -->
  </div>
diff --git a/init/conditions.lisp b/init/conditions.lisp
index a8c8b273..0cf14fbd 100644
--- a/init/conditions.lisp
+++ b/init/conditions.lisp
@@ -1,6 +1,6 @@
 ;; GSL errors                                
 ;; Liam Healy Sat Mar  4 2006 - 18:33
-;; Time-stamp: <2008-11-16 14:47:24EST conditions.lisp>
+;; Time-stamp: <2008-12-27 16:42:45EST conditions.lisp>
 ;; $Id$
 
 (in-package :gsl)
@@ -42,9 +42,9 @@
       ((error-number :initform ,number :reader error-number :allocation :class)
        (error-text :initform ,text :reader error-text :allocation :class))
       (:documentation
-       (format nil
-	       "The condition ~a, ~a, signalled by the GNU Scientific Library."
-	       ',keyword ,text)))
+       ,(format nil
+	       "The condition ~a, `~a,' signalled by the GNU Scientific Library."
+	       keyword text)))
     (setf *errorno-keyword* (acons ,number ',keyword *errorno-keyword*))
     (export ',keyword)))
 
diff --git a/init/defmfun.lisp b/init/defmfun.lisp
index 872b60ce..14fb1084 100644
--- a/init/defmfun.lisp
+++ b/init/defmfun.lisp
@@ -1,6 +1,6 @@
 ;; Macro for defining GSL functions.
 ;; Liam Healy 2008-04-16 20:49:50EDT defmfun.lisp
-;; Time-stamp: <2008-12-21 22:50:20EST defmfun.lisp>
+;; Time-stamp: <2008-12-27 17:02:11EST defmfun.lisp>
 ;; $Id$
 
 (in-package :gsl)
@@ -86,6 +86,7 @@
 
 (defun expand-defmfun-wrap (name arglist gsl-name c-arguments key-args)
   (let (indexed-functions)
+    (declare (ignorable indexed-functions)) ; workaround for compiler errors that don't see it's used
     (with-defmfun-key-args key-args
       (setf indexed-functions (list))
       (wrap-index-export
@@ -523,11 +524,12 @@
   "A complete definition form, starting with defun, :method, or defmethod."
   (destructuring-bind
 	(&key documentation inputs outputs after qualifier &allow-other-keys) key-args
+    (declare (ignorable inputs outputs)) ; workaround for compiler errors that don't see it's used
     `(,definition
 	 ,@(when (and name (not (defgeneric-method-p name)))
 		 (list name))
 	 ,@(when qualifier (list qualifier))
-	 ,arglist
+       ,arglist
        ,(declaration-form
 	 (cl-argument-types arglist c-arguments)
 	 (set-difference (arglist-plain-and-categories arglist nil)
@@ -601,7 +603,7 @@
 		     `((check-gsl-status ,cret-name
 					 ',(or (defgeneric-method-p name) name)))))
 	    #-native
-	    ,@(when outputs `(,(mapcar (lambda (x) `(setf (cl-invalid ,x) t))) outputs))
+	    ,@(when outputs (mapcar (lambda (x) `(setf (cl-invalid ,x) t)) outputs))
 	    ,@(when (eq cret-type :pointer)
 		    `((check-null-pointer
 		       ,cret-name
-- 
GitLab