Skip to content
Snippets Groups Projects
Commit 5c945eb5 authored by liam's avatar liam
Browse files

Use cffi-unix (http://www.cliki.net/cffi-unix) to properly abstract

Unix's size_t with :size (instead of :uint, which isn't always right).


git-svn-id: svn+ssh://pop/opt/space/mathematics/gsl/trunk@2997 a3d8a0fb-c1db-0310-ace7-a616afeb9e30
parent a2104172
No related branches found
No related tags found
No related merge requests found
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
; description: Definition of GSLL system ; description: Definition of GSLL system
; date: ; date:
; author: Liam Healy ; author: Liam Healy
; modified: Tue Mar 21 2006 - 23:10 ; modified: Fri Mar 24 2006 - 15:33
;******************************************************** ;********************************************************
;;; $Id: $ ;;; $Id: $
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
:version "0" :version "0"
:author "Liam M. Healy" :author "Liam M. Healy"
:licence "GPL" :licence "GPL"
:depends-on (cffi) :depends-on (cffi cffi-unix) ; http://www.cliki.net/cffi-unix
:components :components
((:file "init") ((:file "init")
(:file "interface" :depends-on (init)) (:file "interface" :depends-on (init))
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
; description: Load GSL ; description: Load GSL
; date: Sat Mar 4 2006 - 18:53 ; date: Sat Mar 4 2006 - 18:53
; author: Liam M. Healy ; author: Liam M. Healy
; modified: Wed Mar 8 2006 - 22:27 ; modified: Fri Mar 24 2006 - 15:30
;******************************************************** ;********************************************************
(defpackage gsll (defpackage gsll
...@@ -21,3 +21,7 @@ ...@@ -21,3 +21,7 @@
(t (:default "libgsl"))) (t (:default "libgsl")))
(cffi:use-foreign-library libgsl) (cffi:use-foreign-library libgsl)
;;; If cffi-unix is unavailable, uncomment the appropriate line:
;;; (cffi:defctype :size :unsigned-long) ; for 64 bit computers
;;; (cffi:defctype :size :uint) ; for 32 bit computers
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
; description: Polynomials ; description: Polynomials
; date: Tue Mar 21 2006 - 18:33 ; date: Tue Mar 21 2006 - 18:33
; author: Liam M. Healy ; author: Liam M. Healy
; modified: Thu Mar 23 2006 - 10:47 ; modified: Fri Mar 24 2006 - 15:09
;******************************************************** ;********************************************************
;;; $Id: $ ;;; $Id: $
...@@ -63,7 +63,7 @@ ...@@ -63,7 +63,7 @@
:pointer dd :pointer dd
:pointer xac :pointer xac
:pointer yac :pointer yac
:uint size ; "size_t is almost always an unsigned int" :size size
:int)) :int))
(list dd xac size))) (list dd xac size)))
...@@ -80,7 +80,7 @@ ...@@ -80,7 +80,7 @@
"gsl_poly_dd_eval" "gsl_poly_dd_eval"
:pointer (first dd) :pointer (first dd)
:pointer (second dd) :pointer (second dd)
:uint (third dd) ; "size_t is almost always an unsigned int" :size (third dd)
:double x :double x
:double)) :double))
...@@ -99,7 +99,7 @@ ...@@ -99,7 +99,7 @@
:double xp :double xp
:pointer (first dd) :pointer (first dd)
:pointer (second dd) :pointer (second dd)
:uint (third dd) ; "size_t is almost always an unsigned int" :size (third dd)
:pointer workspace :pointer workspace
:int) :int)
(cffi::foreign-array-to-lisp (cffi::foreign-array-to-lisp
...@@ -168,7 +168,7 @@ ...@@ -168,7 +168,7 @@
;;; See /usr/include/gsl/gsl_poly.h ;;; See /usr/include/gsl/gsl_poly.h
(cffi:defcstruct poly-complex-workspace (cffi:defcstruct poly-complex-workspace
(nc :uint) (nc :size)
(matrix :pointer)) (matrix :pointer))
(export '(with-poly-complex-workspace)) (export '(with-poly-complex-workspace))
...@@ -176,7 +176,7 @@ ...@@ -176,7 +176,7 @@
"Macro to create and cleanup workspace for polynomial root solver." "Macro to create and cleanup workspace for polynomial root solver."
`(let ((,workspace `(let ((,workspace
(funcall (funcall
(defun-sf :lambda ((n :uint)) (defun-sf :lambda ((n :size))
"gsl_poly_complex_workspace_alloc" "gsl_poly_complex_workspace_alloc"
:return :return
(poly-complex-workspace) (poly-complex-workspace)
...@@ -189,7 +189,7 @@ ...@@ -189,7 +189,7 @@
:c-return-value :void))))) :c-return-value :void)))))
(defun-sf polynomial-solve (defun-sf polynomial-solve
((a :pointer) (n :uint) (workspace poly-complex-workspace)) ((a :pointer) (n :size) (workspace poly-complex-workspace))
"gsl_poly_complex_solve" "gsl_poly_complex_solve"
:documentation :documentation
"The roots of the general polynomial "The roots of the general polynomial
......
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