Rubber Generate
v0.0.11
Template language for generating Ruby bindings for C libraries by Geoff Youngs <[email protected]>
Introduction
A simple ruby-style bindings generator for Ruby. It allows bindings to be laid out in a Ruby style, documentation to be included inline and explicit type casts within C code. It’s somewhere between SWIG and pyrex.
It also allows features extconf.rb creation, including checks for headers, pkg-config etc. The modules it creates currently depend on Ruby/GTK, but it is planned to remove this dependency unless they genuinely require Ruby/GTK.
Other features include custom named type-maps, pre/post code inclusion within functions and some rudimentary understanding of C code.
Changes
- 0.0.11 – 27th Apr 2011 – Fix parsing of %min-version numbers
- 0.0.10 – 27th Apr 2011 – Add —install flag
- 0.0.9 – 31st May 2010
– Add support for —build-dir
switch to specify output directory
- 0.0.8 – 10th May 2010
– Add support for %min-version
. .
- 0.0.7 – 7th May 2010
– Add support for array constants (including autmatic type detection) – e.g array
= [ “Text”, NULL, 3 ] – Add syntax_error function to parser which reports slightly more helpful syntax error messages for a .cr file – Add tracking of code location so that C compiler throws errors which refer to the original line in the .cr file – Add support for GSListtype or GListtype conversion to arrays as return values for functions
- 0.0.6 – 6th May 2010 – Flags class allows wrapping a bit field with slightly more information. Plus automatic conversion to/from ruby and support for integer values.
Dependencies
- Ruby 1.8.6
Example
Sample file:
- example/vte.cr
Usage:
$ rubber-generate —generate —build —install vte.cr
Which should generate [arch]/vte.c <- Source code for extension [arch]/vte.rd <- RD documentation from vte.cr [arch]/extconf.rb <- Config script [arch]/vte.o <- Object file [arch]/vte.so <- Compiled extension
Installation
$ sudo gem install rubber-generate
Credits
Author: Geoff Youngs
Contributors:
- Vincent Isambart