Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

CL lib to parse C headers, and generate FFI for CL(CFFI) and Julia

branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

readme.markdown

Note: i dont work on this anymore atm, i moved stuff still worked on to julia-ffi a parser is WIP there aswel.

Parse C headers

I wrote this Common Lisp code to parse preprocessed C headers and use that data to generate cffi code(inside macro). (I have had trouble using other peoples' code like the 'groveller')

There is also a Julia code outputter.(see note above) julia-src/ contains code that is autogenerated, and other code to help use Julia's features. Only some openGL stuff and SDL stuff is very usable at the moment. (The SDL stuff doesn't use the parser, just some basic hooks into it) See the julia-src/ readme for more.

As parser, the current status is 'maybe it works', at best, but for me it is very useful to not have to do stuff manually.(However there not seeming a good program/lib to get this data from include files kindah sucks..)

Considerations

Of course multiple ways of doing things; getting an FFI using an include file could just be (ffi-using-include-file "include-file" :package-name ...other options..) or some such. But i think it is better to have a file, firstly to 'memoize' the result so no parsing has to place in development, and secondly to guard against the possibility of suddenly the output changing subtilly or worries like that.. You keep the script at hand, and try only using that to change those files.

I do want to keep the automatedly created files completely automated and anything beyond that in separate files. Also any operations on how the FFI is done should be transparent..

Currently there is just a function to throw things out from being FFI-ed, structs, for instance, as not yet supported, and some #defines because for instance in GL/gl.h, @define APIENTRY extern would give Julia an entry APIENTRY = extern, which doesn't make sense. Problem of course is that the parser doesn't know if C's #defines are values or not.

(Common Lisp side)Dependencies

Uses some stuff like Alexandria, and some of my string stuff from j-basic. (notably j-string-utils:tokenize), as usual.

:to-cffi needs to make symbols in CFFI

:header-cffi helps using the program to preprocess, as such it uses external-program.

TODO(maybe)

  • I want to have structs accessible for Julia. Automatically make a creator of a struct and accessor.

  • Trying to get more stuff parsed and ffi'ed in /usr/include/

  • Convert to Julia entirely?

Copyright

Everything is under GPLv3, license included under doc/

Author

Jasper den Ouden

Something went wrong with that request. Please try again.