[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [spr1126] Changing C function interface from IBUKI to Allegro
>> I was passing arrays, but it seems to me that you need to pass
>> the dimensions of the array, while you can get the dimensions or the
>> rank from C functions of IBUKI or KCL. I have to modify a portion of
>> the C code anyway, but I would appreciate any tool or suggestion on
>> the porting the C function interface.
As you've noticed when multidimensional arrays are passed to C we
only pass a pointer to the data part of the array (thus if the Lisp
and C code agree beforehand on the side of the array the C code can
access the data in a natural fashion, i.e. just as if it was called
from another C function). If you want to pass to C an array whose
size isn't know until runtime then you'll have to pass in the
dimensions as well.
Multi-dimensional arrays are represented in Lisp as array header
objects. The array header contains the dimension information
and a pointer to the data portion. If you want to be passed the
the array header itself rather than the data portion you'll have to
pass to C a Lisp object containing the array and then reach inside that
Lisp object to get the array header. The C include file lisp.h
contains C macros to look in a Lisp object. The A_dims macro
extracts the dimensions of the arrray which is a list of fixnums.