[Openmcl-devel] ccl:with-pointer-to-ivector for simple-arrays

Vebjorn Ljosa vebjorn at ljosa.com
Fri Jun 5 06:48:53 PDT 2009


On Jun 5, 2009, at 08:39, Gary Byers wrote:

> A multidimensional array in CCL is always (at least implicitly)
> displaced.

> An internal function - CCL::ARRAY-DATA-AND-OFFSET - which is based on
> something that someone proposed for inclusion in CL but was never
> adopted - will follow any transitive displacement chain associated
> with its array argument and return the underlying simple one- 
> dimensional
> array (and the cumulative DISPLACED-INDEX-OFFSET as a second value.)

Thank you so much!  I got it to work now:

#+ccl
(defmacro with-pointer-to-array-data ((ptr-var array) &body body)
   (let ((v (gensym)))
     `(let ((,v (ccl::array-data-and-offset ,array)))
        (unless (typep ,v 'ccl::ivector)
	 (ccl::report-bad-arg ,v 'ccl::ivector))
        (ccl::without-gcing
          (ccl:with-macptrs ((,ptr-var))
            (ccl::%vect-data-to-macptr ,v ,ptr-var)
            , at body)))))

Vebjorn



More information about the Openmcl-devel mailing list