[Openmcl-devel] Fwd: [info-mcl] Making C arrays in OpenMCL
Andrew Shalit
alms at clozure.com
Mon Apr 21 08:49:39 PDT 2008
Keith -- I'm glad to hear that your port is going well. I'm taking
the liberty of forwarding your message to the OpenMCL-Devel e-mail
list, where it has more of a chance of being answered.
Andrew
Begin forwarded message:
> From: "Keith L. Downing" <Keith.Downing at idi.ntnu.no>
> Date: April 20, 2008 4:58:21 PM EDT
> To: Discussion list for MCL users <info-mcl at clozure.com>
> Subject: [info-mcl] Making C arrays in OpenMCL
> Reply-To: Discussion list for MCL users <info-mcl at clozure.com>
>
> As part of my graphics conversion from MCL to OpenMCL (which is
> actually going quite well), I'm trying to
> use a variety of line types: solid, dash, dash-dot, etc. I declare
> each type as a CL global variable, which
> then points to an object that houses, among other things, a pointer
> to a small C array that codes the
> specification for the line type (as described in the "COCOA Drawing
> Guide" (pg. 75)). It's the pointer to
> this 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 impression
> is that make-heap-ivector will do this for me, and it does seem to
> work when the element-type argument
> is '(unsigned-byte 64), for example. But it doesn't seem to work
> when I use '(double-float 64). And it
> appears 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 of
> foreign type keywords than those listed in the OpenMCL online
> documentation? Or maybe there's just a better way to
> create C arrays in OpenMCL? make-heap-ivector makes it LOOK so
> easy, but maybe it's not very general? So far, I
> can'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 at clozure.com
> http://clozure.com/mailman/listinfo/info-mcl
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.clozure.com/pipermail/openmcl-devel/attachments/20080421/15023043/attachment.htm>
More information about the Openmcl-devel
mailing list