Git Product home page Git Product logo

ffi-swig-generator's Introduction

ffi-swig-generator

by Andrea Fazzi
http://github.com/ffi/ffi-swig-generator

DESCRIPTION:

ffi-swig-generator is a ruby-ffi wrapper code generator that produces ruby-ffi glue code parsing C header files through SWIG.

ffi-swig-generator is able to traverse an XML parse tree generated by the swig command and to produce a ruby-ffi code from it.

ffi-swig-generator is shipped with a command line tool and a rake task that automates the code generation process.

ffi-swig-generator XML capabilities are provided by nokogiri.

FEATURES/PROBLEMS:

  • The program is able to generate:

    • all C native types

    • #define constants

    • typedefs

    • struct, union, array and enum types

    • callbacks (pointers to functions)

  • Naive indentation of the generated code

SYNOPSIS:

From command line:

ffi-gen mylib.xml mylib.rb

From a Rakefile:

require 'ffi-swig-generator'
FFI::Generator::Task.new do |task|
  task.input_fn = 'my_interface_dir/*.i'
  task.output_dir = 'my_output_dir'
end

REQUIREMENTS:

  • rake >= 0.8.3

  • nokogiri >= 1.1.1

  • swig >= 1.3

DOWNLOAD/INSTALL:

Download and install from rubygems:

[sudo] gem install ffi-swig-generator

or clone the git repository:

git clone git://github.com/ffi/ffi-swig-generator.git

EXAMPLES:

See the examples in examples/ folder.

libc.i is an interface file containing some excerpt of libc functions.

wiiuse.i is a fairly complex example of a C header file interface. It reproduces the content of wiiuse.h, the header file of the wiiuse library. wiiuse is a C library that handles the connection with Nintendo Wiimote devices. The interface file is almost a mere copy/paste from the original header file. See [1] for an updated revision of ffi-wiiuse library.

PROJECTS RELATED TO ffi-swig-generator

The generator has been used to generate code for the projects below. Take a look at them to see further usage examples.

  1. github.com/remogatto/ffi-wiiuse/

  2. github.com/remogatto/ffi-opengl/

  3. github.com/remogatto/ffi-spidermonkey/

  4. github.com/remogatto/ffi-tcc/

LICENSE:

(The MIT License)

Copyright © 2009 Andrea Fazzi

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ‘Software’), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

ffi-swig-generator's People

Contributors

dmlary avatar phemmer avatar vp-of-awesome avatar windwiny avatar bikenomad avatar galdor avatar davispuh avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.