From 5c945eb57a42623069a830666cce1841daa20f5c Mon Sep 17 00:00:00 2001 From: liam <liam@a3d8a0fb-c1db-0310-ace7-a616afeb9e30> Date: Fri, 24 Mar 2006 20:35:18 +0000 Subject: [PATCH] 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 --- gsll.asd | 4 ++-- init.lisp | 6 +++++- polynomial.lisp | 14 +++++++------- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/gsll.asd b/gsll.asd index e423e258..c810df2e 100644 --- a/gsll.asd +++ b/gsll.asd @@ -3,7 +3,7 @@ ; description: Definition of GSLL system ; date: ; author: Liam Healy -; modified: Tue Mar 21 2006 - 23:10 +; modified: Fri Mar 24 2006 - 15:33 ;******************************************************** ;;; $Id: $ @@ -13,7 +13,7 @@ :version "0" :author "Liam M. Healy" :licence "GPL" - :depends-on (cffi) + :depends-on (cffi cffi-unix) ; http://www.cliki.net/cffi-unix :components ((:file "init") (:file "interface" :depends-on (init)) diff --git a/init.lisp b/init.lisp index 62f67f61..5ed29661 100644 --- a/init.lisp +++ b/init.lisp @@ -3,7 +3,7 @@ ; description: Load GSL ; date: Sat Mar 4 2006 - 18:53 ; author: Liam M. Healy -; modified: Wed Mar 8 2006 - 22:27 +; modified: Fri Mar 24 2006 - 15:30 ;******************************************************** (defpackage gsll @@ -21,3 +21,7 @@ (t (:default "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 diff --git a/polynomial.lisp b/polynomial.lisp index 55515230..f68e8658 100644 --- a/polynomial.lisp +++ b/polynomial.lisp @@ -3,7 +3,7 @@ ; description: Polynomials ; date: Tue Mar 21 2006 - 18:33 ; author: Liam M. Healy -; modified: Thu Mar 23 2006 - 10:47 +; modified: Fri Mar 24 2006 - 15:09 ;******************************************************** ;;; $Id: $ @@ -63,7 +63,7 @@ :pointer dd :pointer xac :pointer yac - :uint size ; "size_t is almost always an unsigned int" + :size size :int)) (list dd xac size))) @@ -80,7 +80,7 @@ "gsl_poly_dd_eval" :pointer (first dd) :pointer (second dd) - :uint (third dd) ; "size_t is almost always an unsigned int" + :size (third dd) :double x :double)) @@ -99,7 +99,7 @@ :double xp :pointer (first dd) :pointer (second dd) - :uint (third dd) ; "size_t is almost always an unsigned int" + :size (third dd) :pointer workspace :int) (cffi::foreign-array-to-lisp @@ -168,7 +168,7 @@ ;;; See /usr/include/gsl/gsl_poly.h (cffi:defcstruct poly-complex-workspace - (nc :uint) + (nc :size) (matrix :pointer)) (export '(with-poly-complex-workspace)) @@ -176,7 +176,7 @@ "Macro to create and cleanup workspace for polynomial root solver." `(let ((,workspace (funcall - (defun-sf :lambda ((n :uint)) + (defun-sf :lambda ((n :size)) "gsl_poly_complex_workspace_alloc" :return (poly-complex-workspace) @@ -189,7 +189,7 @@ :c-return-value :void))))) (defun-sf polynomial-solve - ((a :pointer) (n :uint) (workspace poly-complex-workspace)) + ((a :pointer) (n :size) (workspace poly-complex-workspace)) "gsl_poly_complex_solve" :documentation "The roots of the general polynomial -- GitLab