[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ff-interface: defcstruct
- To: firstname.lastname@example.org (Tobias Kunze)
- Subject: Re: ff-interface: defcstruct
- From: email@example.com (Bill St. Clair)
- Date: Mon, 27 Sep 1993 14:49:23 -0500
- Cc: info-mcl
At 8:19 AM 9/26/93 +0100, Tobias Kunze wrote:
>while trying to port code running under franz lisp on the Next i get
>into troubles with mcl's ff-interface.
>the main point is that i need some kind of defcstruct facility, that is,
>machinery to deal with structures on the c side from within lisp:
>accessors should be provided for every c-side structure field, even for
>fields of embedded structures, and for elements of arrays that are
>referred to via pointers.
MCL's DEFRECORD should do the trick. Unfortunately, there is no automatic
translation facility for C header files (though we do have one for Pascal
>secondly, i'm having hard times to figure out how to pass floats and
>doubles back and forth to C and Lisp; the manual has only a %copy-float
>function and everything from %get/%put-byte to -long.
There are a couple of undocumented accessors for floats in the foreign
function library (available after you (require "FF")). I sent out
some info about them a few weeks ago:
To: firstname.lastname@example.org (Ray Lam)
From: email@example.com (Bill St. Clair)
Subject: Re: Accessing C floating point data type in MCL
At 4:26 PM 8/26/93 -0800, Ray Lam wrote:
> I'm looking for a function simular to "%get-long" but it will work on
>a ptr to a floating point number in C. I was looking into the
>file and found the function "%get-x2float". Can anyone tell me what that
Reads a 10-byte IEEE extended float from ptr and returns it as an
MCL 8-byte float.
(ccl::%float2x float ptr)
Stores the 8-byte MCL float as a 10-byte IEEE extended float at ptr.
(defun %safe-get-double (ptr)
; Reads an 8-byte IEEE double float from ptr and returns an 8-byte MCL float
(let ((float (ccl::%copy-float 1.0)))
(ccl::%get-double ptr float)
(ccl::%put-double flt ptr)
Stores the 8-byte MCL float as an 8-byte IEEE double float at ptr.