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

Pass 'finalize argument from make-foreign-array-from-mpointer to grid:make-grid

parent 42dfd182
No related branches found
No related tags found
No related merge requests found
;; A grid:foreign-array with added metadata for GSL. ;; A grid:foreign-array with added metadata for GSL.
;; Liam Healy 2008-04-06 21:23:41EDT ;; Liam Healy 2008-04-06 21:23:41EDT
;; Time-stamp: <2010-07-13 10:24:43EDT foreign-array.lisp> ;; Time-stamp: <2010-07-13 12:06:45EDT foreign-array.lisp>
;; ;;
;; Copyright 2008, 2009, 2010 Liam M. Healy ;; Copyright 2008, 2009, 2010 Liam M. Healy
;; Distributed under the terms of the GNU General Public License ;; Distributed under the terms of the GNU General Public License
...@@ -75,7 +75,8 @@ ...@@ -75,7 +75,8 @@
;; foreign-array. ;; foreign-array.
(defun make-foreign-array-from-mpointer (defun make-foreign-array-from-mpointer
(mpointer &optional (element-type 'double-float) (category :vector)) (mpointer
&optional (element-type 'double-float) (category :vector) finalize)
"Make the foreign array when a GSL pointer to a "Make the foreign array when a GSL pointer to a
gsl-vector-c or gsl-matrix-c is given." gsl-vector-c or gsl-matrix-c is given."
(let* ((cstruct (let* ((cstruct
...@@ -95,6 +96,7 @@ ...@@ -95,6 +96,7 @@
,(cffi:foreign-slot-value mpointer cstruct 'size1)) ,(cffi:foreign-slot-value mpointer cstruct 'size1))
,element-type))) ,element-type)))
:foreign-pointer :foreign-pointer
(cffi:foreign-slot-value mpointer cstruct 'data)))) (cffi:foreign-slot-value mpointer cstruct 'data)
:finalizer finalize)))
(setf (grid:metadata-slot fa 'mpointer) mpointer) (setf (grid:metadata-slot fa 'mpointer) mpointer)
fa)) fa))
;; Generate a lambda that calls the user function; will be called by callback. ;; Generate a lambda that calls the user function; will be called by callback.
;; Liam Healy ;; Liam Healy
;; Time-stamp: <2010-07-13 10:37:28EDT funcallable.lisp> ;; Time-stamp: <2010-07-13 12:06:01EDT funcallable.lisp>
;; ;;
;; Copyright 2009, 2010 Liam M. Healy ;; Copyright 2009, 2010 Liam M. Healy
;; Distributed under the terms of the GNU General Public License ;; Distributed under the terms of the GNU General Public License
...@@ -68,7 +68,8 @@ ...@@ -68,7 +68,8 @@
`(make-foreign-array-from-mpointer `(make-foreign-array-from-mpointer
,ptr ,ptr
',(grid:cffi-cl (parse-callback-argspec argspec 'element-type)) ',(grid:cffi-cl (parse-callback-argspec argspec 'element-type))
,(length (parse-callback-argspec argspec 'dimensions)))) ,(length (parse-callback-argspec argspec 'dimensions))
t))
(:cvector ; a raw C vector (:cvector ; a raw C vector
`(grid:make-foreign-array-from-pointer `(grid:make-foreign-array-from-pointer
,ptr ,ptr
......
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