Matt Wette
2018-04-05 23:16:40 UTC
Just to let nyacc c99 uses know ...
In the process of testing my "FFI Helper" I have found it necessary to
expand the
nyacc c99 parser a bit.
First of all, thanks to Taylan for providing great support for his
scheme-bytestructures
package. This provide the C-Scheme compatibility needed to support
calling into C
libraries.
I am currently working on generating a dbus mainloop from libdbus and
epoll with the
ffi-helper. It turns out that epoll used packed structures. This means
that the nyacc
c99 parser has to be upgraded to parse the gcc __attributes__ extension
and this
structure needs to be carried up into the C-to-Scheme conversion
process. I still have
a bit of work to go but it turns out that scheme-bytestructures provided
a flags for
specifying packed structures. Away I go to get this working ...
struct epoll_event {
uint32_t events;
epoll_data_t data;
} __attribute__ ((__packed__));
=>
|| (decl (decl-spec-list
(type-spec
(struct-def
(@ ("__packed__" ""))
(ident "epoll_event")
(field-list
(comp-decl
(decl-spec-list
(type-spec (typename "uint32_t")))
(comp-declr-list (comp-declr (ident "events"))))
(comp-decl
(decl-spec-list
(type-spec (typename "epoll_data_t")))
(comp-declr-list (comp-declr (ident "data"))))))))))
In the process of testing my "FFI Helper" I have found it necessary to
expand the
nyacc c99 parser a bit.
First of all, thanks to Taylan for providing great support for his
scheme-bytestructures
package. This provide the C-Scheme compatibility needed to support
calling into C
libraries.
I am currently working on generating a dbus mainloop from libdbus and
epoll with the
ffi-helper. It turns out that epoll used packed structures. This means
that the nyacc
c99 parser has to be upgraded to parse the gcc __attributes__ extension
and this
structure needs to be carried up into the C-to-Scheme conversion
process. I still have
a bit of work to go but it turns out that scheme-bytestructures provided
a flags for
specifying packed structures. Away I go to get this working ...
struct epoll_event {
uint32_t events;
epoll_data_t data;
} __attribute__ ((__packed__));
=>
|| (decl (decl-spec-list
(type-spec
(struct-def
(@ ("__packed__" ""))
(ident "epoll_event")
(field-list
(comp-decl
(decl-spec-list
(type-spec (typename "uint32_t")))
(comp-declr-list (comp-declr (ident "events"))))
(comp-decl
(decl-spec-list
(type-spec (typename "epoll_data_t")))
(comp-declr-list (comp-declr (ident "data"))))))))))