Commit e60172b9 authored by Liam Healy's avatar Liam Healy
Browse files

Merge branch 'master' of ssh://repo.or.cz/srv/git/gsd

parents 26a9088c 89286088
;; Foreign (C or C-compatible) arrays
;; Liam Healy 2008-12-28 10:44:22EST foreign-array.lisp
;; Time-stamp: <2010-04-25 21:27:18EDT foreign-array.lisp>
;; Time-stamp: <2010-04-26 09:51:57EDT foreign-array.lisp>
;;
;; Copyright 2008, 2009 Liam M. Healy
;; Distributed under the terms of the GNU General Public License
......@@ -191,9 +191,10 @@
(row-major-aref array array-index))))))
(defun copy-array-from-pointer (array pointer lisp-type index-offset length)
"Copy length elements from array (starting at index-offset) of type
lisp-type from the memory area that starts at pointer, coercing the
elements if necessary."
"Copy the foreign array at the pointer into a CL array. Copy
'length elements from the foreign array (starting at
index-offset) of type 'lisp-type from the memory area, coercing the
elements if necessary. Return the CL array."
(let ((cffi-type (component-type lisp-type)))
(loop :repeat length
for pointer-index :from 0 :by (if (subtypep lisp-type 'complex) 2 1)
......@@ -204,7 +205,8 @@
(complex
(cffi:mem-aref pointer cffi-type pointer-index)
(cffi:mem-aref pointer cffi-type (1+ pointer-index)))
(cffi:mem-aref pointer cffi-type pointer-index))))))
(cffi:mem-aref pointer cffi-type pointer-index))))
array))
;;;;****************************************************************************
;;;; Make CL arrays from foreign arrays
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment