ffi-clang

FORK: Ruby FFI bindings for my custom patched clang 8.0.
git clone https://git.neptards.moe/neptards/ffi-clang.git
Log | Files | Refs | README

README.md (2557B)


      1 # FFI::Clang
      2 
      3 A light-weight wrapper for Ruby exposing [libclang][1]. Works for libclang v3.4+.
      4 
      5 [![Build Status](https://secure.travis-ci.org/ioquatix/ffi-clang.svg)](http://travis-ci.org/ioquatix/ffi-clang)
      6 [![Code Climate](https://codeclimate.com/github/ioquatix/ffi-clang.svg)](https://codeclimate.com/github/ioquatix/ffi-clang)
      7 
      8 [1]: http://llvm.org/devmtg/2010-11/Gregor-libclang.pdf
      9 
     10 ## Installation
     11 
     12 Add this line to your application's Gemfile:
     13 
     14 	gem 'ffi-clang'
     15 
     16 And then execute:
     17 
     18 	$ bundle
     19 
     20 Or install it yourself as:
     21 
     22 	$ gem install ffi-clang
     23 
     24 ## Usage
     25 
     26 Traverse the AST in the given file:
     27 
     28 	index = Index.new
     29 	translation_unit = index.parse_translation_unit("list.c")
     30 	cursor = translation_unit.cursor
     31 	cursor.visit_children do |cursor, parent|
     32 		puts "#{cursor.kind} #{cursor.spelling.inspect}"
     33 		
     34 		next :recurse 
     35 	end
     36 
     37 ### Library Version
     38 
     39 Due to issues figuring out which library to use, we require you to manually specify it. For example, to run the tests, with MacPorts llvm/clang 3.4, use the following:
     40 
     41 	LLVM_CONFIG=llvm-config-mp-3.4 rake
     42 
     43 ## Contributing
     44 
     45 1. Fork it
     46 2. Create your feature branch (`git checkout -b my-new-feature`)
     47 3. Commit your changes (`git commit -am 'Add some feature'`)
     48 4. Push to the branch (`git push origin my-new-feature`)
     49 5. Create new Pull Request
     50 
     51 ## License
     52 
     53 Copyright, 2010-2012, by Jari Bakken.  
     54 Copyright, 2013, by Samuel G. D. Williams. <http://www.codeotaku.com>  
     55 Copyright, 2013, by Garry C. Marshall. <http://www.meaningfulname.net>  
     56 Copyright, 2014, by Masahiro Sano.
     57 
     58 Permission is hereby granted, free of charge, to any person obtaining a copy
     59 of this software and associated documentation files (the "Software"), to deal
     60 in the Software without restriction, including without limitation the rights
     61 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     62 copies of the Software, and to permit persons to whom the Software is
     63 furnished to do so, subject to the following conditions:
     64 
     65 The above copyright notice and this permission notice shall be included in
     66 all copies or substantial portions of the Software.
     67 
     68 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     69 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     70 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     71 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     72 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     73 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     74 THE SOFTWARE.