20 Apr 22:56
Making C arrays in OpenMCL
From: Keith L. Downing <Keith.Downing@...>
Subject: Making C arrays in OpenMCL
Newsgroups: gmane.lisp.mcl.general
Date: 2008-04-20 20:58:21 GMT
Subject: Making C arrays in OpenMCL
Newsgroups: gmane.lisp.mcl.general
Date: 2008-04-20 20:58:21 GMT
As part of my graphics conversion from MCL to OpenMCL (which is actually going quite well), I'm trying touse a variety of line types: solid, dash, dash-dot, etc. I declare each type as a CL global variable, whichthen points to an object that houses, among other things, a pointer to a small C array that codes thespecification for the line type (as described in the "COCOA Drawing Guide" (pg. 75)). It's the pointer tothis array that then gets passed to Objective C for drawing the line (as part of a Bezier curve).
However, I'm having trouble creating these arrays in Objective C via the foreign-function interface. My impressionis that make-heap-ivector will do this for me, and it does seem to work when the element-type argumentis '(unsigned-byte 64), for example. But it doesn't seem to work when I use '(double-float 64). And itappears that the Obj-C drawing routines need a float array for the line-type specification.
Does anyone know if make-heap-ivector really works for all element types, or if there's a different list offoreign type keywords than those listed in the OpenMCL online documentation? Or maybe there's just a better way tocreate C arrays in OpenMCL? make-heap-ivector makes it LOOK so easy, but maybe it's not very general? So far, Ican't get it to work with any of the float types (single-float or double-float).
(defun make-heap-ivector (element-count element-type) (let* ((subtag (ccl::element-type-subtype element-type))) (unless (= (logand subtag target::fulltagmask) target::fulltag-immheader) (error "~s is not an ivector subtype." element-type)) (let* ((size-in-bytes (ccl::subtag-bytes subtag element-count))) (ccl::%make-heap-ivector subtag size-in-bytes element-count)))) MAKE-HEAP-IVECTOR
Cheers...
Keith Downing (who hopes to quietly recede into the shadows of this mailing list once this graphics conversion is complete) Trondheim, Norway
However, I'm having trouble creating these arrays in Objective C via the foreign-function interface. My impressionis that make-heap-ivector will do this for me, and it does seem to work when the element-type argumentis '(unsigned-byte 64), for example. But it doesn't seem to work when I use '(double-float 64). And itappears that the Obj-C drawing routines need a float array for the line-type specification.
Does anyone know if make-heap-ivector really works for all element types, or if there's a different list offoreign type keywords than those listed in the OpenMCL online documentation? Or maybe there's just a better way tocreate C arrays in OpenMCL? make-heap-ivector makes it LOOK so easy, but maybe it's not very general? So far, Ican't get it to work with any of the float types (single-float or double-float).
(defun make-heap-ivector (element-count element-type) (let* ((subtag (ccl::element-type-subtype element-type))) (unless (= (logand subtag target::fulltagmask) target::fulltag-immheader) (error "~s is not an ivector subtype." element-type)) (let* ((size-in-bytes (ccl::subtag-bytes subtag element-count))) (ccl::%make-heap-ivector subtag size-in-bytes element-count)))) MAKE-HEAP-IVECTOR
Cheers...
Keith Downing (who hopes to quietly recede into the shadows of this mailing list once this graphics conversion is complete) Trondheim, Norway
_______________________________________________ info-mcl mailing list info-mcl@... http://clozure.com/mailman/listinfo/info-mcl
RSS Feed