Hello Luis,
Thank you for your reply!
(defcenum (:a 1) ... (:c #.(logior 1 2)) ...).
My point regarding "enum" definition was actually if it is
possible to write down a definition of enum in CFFI without
breaking the "abstraction". In the body of enum as you see
there is an interdependency between the fields of enum
being defined: the value of c depends on a and b and
the value of d depends on c.
>> but it has some limitations and it's
>> undocumented (see src/types.lisp).
With that CFFI array type "*/typedef char XXX[8]/*"
can be translated now as "/*(defctype XXX (:array :char 8))*/"!
What are those limitations?
Regards
Nik
On 03/07/2011 11:14 AM, Luís Oliveira wrote:
Hello Nik,
On Mar 2, 2011 6:01 PM, "nitralime"<nitral...@googlemail.com> wrote:
Hopefully here is the right place to ask CFFI user related questions.
What would be an appropriate CFFI definition for the following C entities?
1) typedef enum {
a = 0x01,
b = 0x02,
c = a | b,
d = 0x04 | c
} test;
It's a bit cumbersome to express that with CFFI. Something like
(defcenum (:a 1) ... (:c #.(logior 1 2)) ...).
2) typedef char XXX[8];
How are the C arrays handled in CFFI?
There are some array operations such as mem-aref, and you can allocate
them using foreign-alloc. defcstruct supports arrays via :count.
There's also an :array type that will convert C arrays to Lisp arrays,
but it has some limitations and it's
undocumented (see src/types.lisp).
HTH,
--
Luís Oliveira
http://r42.eu/~luis
_______________________________________________
cffi-devel mailing list
cffi-devel@common-lisp.net
http://common-lisp.net/cgi-bin/mailman/listinfo/cffi-devel