well I have to do a glue layer for it any way because the macro gets an unidentified alien function error when I try to call it from a defcfun in lisp...I write alot of glue code for unidentified alien function errors but those are for functions not macros. could you help get me started writing a glue layer for this macro i posted so i can call it in a defcfun for c....i have no idea how to type cast the parameters or how to do a return on them...btw .sorry if i sent a reply to your mailbox Frank =)
On Saturday, November 2, 2013 9:23 AM, Frank Gönninger frank.goenninger@consequor.de wrote:
This is a simple code generation C macro, so this is simple to be
transcripted into Common Lisp. There are several alternatives to do this.
Either you write the code explicitly in every use occasion or you write a Common Lisp macro that does the same.
(defmacro cv-seq-elem( seq elem_type index ) `( Š
But why do you what to do this in
Lisp? I would rather write some glue
layer in C and have much simpler calls from Lisp to C.
Good luck.
Frank
Am 02.11.13 16:43 schrieb "Joeish W" unter joeish80829@yahoo.com:
I'm trying to wrap the GET_SEQ_ELEM macro below can some one give me clues or example how i would go about this easily
with a cffi function like defcfun...If there is no clear way i definately propose an addendum to cffi for wrapping macros
#define CV_SEQ_ELEM( seq, elem_type, index )
\
/* assert gives some guarantee that <seq> parameter is valid */ \
( assert(sizeof((seq)->first[0]) == sizeof(CvSeqBlock) && \
(seq)->elem_size == sizeof(elem_type)), \
(elem_type*)((seq)->first && (unsigned)index < \
(unsigned)((seq)->first->count) ? \
(seq)->first->data + (index) *
sizeof(elem_type) : \
cvGetSeqElem( (CvSeq*)(seq), (index) )))
#define CV_GET_SEQ_ELEM( elem_type, seq, index ) CV_SEQ_ELEM( (seq), elem_type, (index) )