Skip to content
Snippets Groups Projects
Commit a6b9010d authored by Liam Healy's avatar Liam Healy
Browse files

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
parent 64fea6a9
No related branches found
No related tags found
No related merge requests found
;; Use the foreign-friendly arrays package. ;; Use the foreign-friendly arrays package.
;; Liam Healy 2008-03-22 15:40:08EDT ;; 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$ ;; $Id$
;;; Foreign-friendly arrays (original implementation by Tamas Papp) ;;; Foreign-friendly arrays (original implementation by Tamas Papp)
...@@ -125,19 +125,6 @@ ...@@ -125,19 +125,6 @@
;;;; Pointer management ;;;; 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 #+native
(defmacro with-pointer-to-array ((array pointer cffi-type length) (defmacro with-pointer-to-array ((array pointer cffi-type length)
&body body) &body body)
......
;; Get/set array or elements: cl-array, maref ;; Get/set array or elements: cl-array, maref
;; Liam Healy 2008-08-27 22:43:10EDT maref.lisp ;; 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: $ ;; $Id: $
(in-package :gsl) (in-package :gsl)
...@@ -101,7 +101,7 @@ ...@@ -101,7 +101,7 @@
(if index2 (if index2
(setf (aref (slot-value object 'cl-array) index index2) value) (setf (aref (slot-value object 'cl-array) index index2) value)
(setf (aref (slot-value object 'cl-array) index) 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) (:method (value (object array) index &optional index2 type)
;; For compatibility, work on CL arrays as well. ;; For compatibility, work on CL arrays as well.
(declare (ignore type)) (declare (ignore type))
......
;; A "marray" is an array in both GSL and CL ;; A "marray" is an array in both GSL and CL
;; Liam Healy 2008-04-06 21:23:41EDT ;; 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$ ;; $Id$
(in-package :gsl) (in-package :gsl)
...@@ -193,7 +193,6 @@ ...@@ -193,7 +193,6 @@
(cl-array object) (cl-array object)
(c-pointer object) (c-pointer object)
(component-type (element-type object)) (component-type (element-type object))
(element-type object)
0 0
(component-size object)) (component-size object))
(setf (c-invalid object) nil))) (setf (c-invalid object) nil)))
...@@ -207,10 +206,9 @@ ...@@ -207,10 +206,9 @@
(cl-array object) (cl-array object)
(c-pointer object) (c-pointer object)
(component-type (element-type object)) (component-type (element-type object))
(element-type object)
0 0
(component-size object)) (component-size object))
(setf cl-invalid nil))) (setf (cl-invalid object) nil)))
#-native #-native
(defun copy-array-to-pointer (array pointer lisp-type index-offset length) (defun copy-array-to-pointer (array pointer lisp-type index-offset length)
......
...@@ -75,10 +75,8 @@ Input domain error |m| > 1.0 in elljac.c at line 46 ...@@ -75,10 +75,8 @@ Input domain error |m| > 1.0 in elljac.c at line 46
<h3>Requirements and Platforms</h3> <h3>Requirements and Platforms</h3>
<div class="content"> <div class="content">
<p> GSLL should work in <p> GSLL should work in any Common Lisp implementation and platform combination
any Common Lisp implementation and platform combination for which the following are supported:
that has <a href="http://common-lisp.net/project/cffi/">CFFI</a>
with callbacks and foreign-funcall support. You will need
</p> </p>
<ul> <ul>
<li><a href="http://www.gnu.org/software/gsl/">GSL</a></li> <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 ...@@ -86,7 +84,10 @@ Input domain error |m| > 1.0 in elljac.c at line 46
(Version 0.10.0 or newer, (Version 0.10.0 or newer,
or <a href="http://packages.debian.org/lenny/cl-cffi">the or <a href="http://packages.debian.org/lenny/cl-cffi">the
version in Debian/lenny</a>) version in Debian/lenny</a>)
Only platforms and implementations which have callbacks and
foreign-funcall support will work.
</li> </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><a href="http://common-lisp.net/project/cl-utilities/">cl-utilities</a>
</li> </li>
<li><a href="http://www.cliki.net/asdf">ASDF</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 ...@@ -94,10 +95,12 @@ Input domain error |m| > 1.0 in elljac.c at line 46
<p> <p>
In <a href="http://www.debian.org">Debian</a> Lenny (5.0) or newer, In <a href="http://www.debian.org">Debian</a> Lenny (5.0) or newer,
the following should work:</p> the following should work:</p>
<blockquote><pre>aptitude install <a <blockquote><pre>
href="http://packages.debian.org/lenny/libgsl0ldbl">libgsl0ldbl</a> <a href="http://packages.debian.org/lenny/cl-cffi">cl-cffi</a></pre></blockquote> aptitude install <a href="http://packages.debian.org/lenny/libgsl0ldbl">libgsl0ldbl</a> <a href="http://packages.debian.org/lenny/cl-cffi">cl-cffi</a>
(asdf is automatically installed with your CL implementation). </pre></blockquote>
Once your CL implementation is running, do 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> <code>(asdf:operate 'asdf:compile-op :gsll)</code>
or, if using Debian with the or, if using Debian with the
<a href="http://packages.debian.org/common-lisp-controller"> <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 ...@@ -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-register-user-package</code> and then within Lisp
<code>(clc:clc-require :gsll)</code>. <code>(clc:clc-require :gsll)</code>.
<p>GSLL has been tested with <a <p>GSLL has been tested with <a
href="http://sbcl.sourceforge.net/">SBCL</a> and <a href="http://sbcl.sourceforge.net/">SBCL</a> on Debian amd64.</p>
href="http://clisp.cons.org/">CLISP</a> on Debian i386 and amd64.</p>
</div> </div>
<h3>Downloads</h3> <h3>Downloads</h3>
<div class="content"> <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>
</ul> </ul>
</div> </div>
...@@ -143,7 +153,7 @@ Input domain error |m| > 1.0 in elljac.c at line 46 ...@@ -143,7 +153,7 @@ Input domain error |m| > 1.0 in elljac.c at line 46
<!-- Created: Feb 25 2005 --> <!-- Created: Feb 25 2005 -->
<!-- hhmts start --> <!-- hhmts start -->
<small> <small>
Time-stamp: <2008-11-16 15:35:22EST index.html> Time-stamp: <2008-12-27 14:33:37EST index.html>
</small> </small>
<!-- hhmts end --> <!-- hhmts end -->
</div> </div>
......
;; GSL errors ;; GSL errors
;; Liam Healy Sat Mar 4 2006 - 18:33 ;; 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$ ;; $Id$
(in-package :gsl) (in-package :gsl)
...@@ -42,9 +42,9 @@ ...@@ -42,9 +42,9 @@
((error-number :initform ,number :reader error-number :allocation :class) ((error-number :initform ,number :reader error-number :allocation :class)
(error-text :initform ,text :reader error-text :allocation :class)) (error-text :initform ,text :reader error-text :allocation :class))
(:documentation (:documentation
(format nil ,(format nil
"The condition ~a, ~a, signalled by the GNU Scientific Library." "The condition ~a, `~a,' signalled by the GNU Scientific Library."
',keyword ,text))) keyword text)))
(setf *errorno-keyword* (acons ,number ',keyword *errorno-keyword*)) (setf *errorno-keyword* (acons ,number ',keyword *errorno-keyword*))
(export ',keyword))) (export ',keyword)))
......
;; Macro for defining GSL functions. ;; Macro for defining GSL functions.
;; Liam Healy 2008-04-16 20:49:50EDT defmfun.lisp ;; 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$ ;; $Id$
(in-package :gsl) (in-package :gsl)
...@@ -86,6 +86,7 @@ ...@@ -86,6 +86,7 @@
(defun expand-defmfun-wrap (name arglist gsl-name c-arguments key-args) (defun expand-defmfun-wrap (name arglist gsl-name c-arguments key-args)
(let (indexed-functions) (let (indexed-functions)
(declare (ignorable indexed-functions)) ; workaround for compiler errors that don't see it's used
(with-defmfun-key-args key-args (with-defmfun-key-args key-args
(setf indexed-functions (list)) (setf indexed-functions (list))
(wrap-index-export (wrap-index-export
...@@ -523,11 +524,12 @@ ...@@ -523,11 +524,12 @@
"A complete definition form, starting with defun, :method, or defmethod." "A complete definition form, starting with defun, :method, or defmethod."
(destructuring-bind (destructuring-bind
(&key documentation inputs outputs after qualifier &allow-other-keys) key-args (&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 `(,definition
,@(when (and name (not (defgeneric-method-p name))) ,@(when (and name (not (defgeneric-method-p name)))
(list name)) (list name))
,@(when qualifier (list qualifier)) ,@(when qualifier (list qualifier))
,arglist ,arglist
,(declaration-form ,(declaration-form
(cl-argument-types arglist c-arguments) (cl-argument-types arglist c-arguments)
(set-difference (arglist-plain-and-categories arglist nil) (set-difference (arglist-plain-and-categories arglist nil)
...@@ -601,7 +603,7 @@ ...@@ -601,7 +603,7 @@
`((check-gsl-status ,cret-name `((check-gsl-status ,cret-name
',(or (defgeneric-method-p name) name))))) ',(or (defgeneric-method-p name) name)))))
#-native #-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) ,@(when (eq cret-type :pointer)
`((check-null-pointer `((check-null-pointer
,cret-name ,cret-name
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment