Don't use C extensions (JRuby compatibility).
This commit is contained in:
parent
049a64946b
commit
5ea0b727d0
10 changed files with 1 additions and 66 deletions
2
src/bindings/ruby/.gitignore
vendored
2
src/bindings/ruby/.gitignore
vendored
|
|
@ -1,3 +1 @@
|
||||||
/tmp/
|
|
||||||
/lib/hammer/hammer_ext.bundle
|
|
||||||
/Gemfile.lock
|
/Gemfile.lock
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,6 @@ source 'https://rubygems.org'
|
||||||
|
|
||||||
gemspec
|
gemspec
|
||||||
|
|
||||||
gem 'rake'
|
|
||||||
gem 'rake-compiler'
|
|
||||||
|
|
||||||
group :test do
|
group :test do
|
||||||
# ...
|
# ...
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,6 @@ Ruby bindings for [hammer](https://github.com/UpstandingHackers/hammer), a parsi
|
||||||
|
|
||||||
* I called the gem `hammer-parser`, since there already is a [gem named `hammer`](https://rubygems.org/gems/hammer).
|
* I called the gem `hammer-parser`, since there already is a [gem named `hammer`](https://rubygems.org/gems/hammer).
|
||||||
|
|
||||||
* C extension not really needed at the moment, if we don't mind hardcoding the token types in the ruby code.
|
|
||||||
|
|
||||||
|
|
||||||
## Development
|
## Development
|
||||||
|
|
||||||
|
|
@ -16,9 +14,7 @@ Ruby bindings for [hammer](https://github.com/UpstandingHackers/hammer), a parsi
|
||||||
|
|
||||||
2. Run `bundle install` to install dependencies.
|
2. Run `bundle install` to install dependencies.
|
||||||
|
|
||||||
3. Run `rake compile` to compile the C extension.
|
3. Run `irb -I ./lib -r hammer` to open `irb` with hammer loaded.
|
||||||
|
|
||||||
4. Run `irb -I ./lib -r hammer` to open `irb` with hammer loaded.
|
|
||||||
|
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
require 'rake/extensiontask'
|
|
||||||
|
|
||||||
#spec = Gem::Specification.load('hammer-parser-ruby.gemspec')
|
|
||||||
#Rake::ExtensionTask.new('hammer_ext', spec)
|
|
||||||
|
|
||||||
Rake::ExtensionTask.new 'hammer_ext' do |ext|
|
|
||||||
ext.lib_dir = 'lib/hammer'
|
|
||||||
end
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
require 'mkmf'
|
|
||||||
|
|
||||||
extension_name = 'hammer_ext'
|
|
||||||
dir_config extension_name
|
|
||||||
|
|
||||||
abort 'ERROR: missing hammer library' unless have_library 'hammer'
|
|
||||||
abort 'ERROR: missing hammer.h' unless have_header 'hammer.h'
|
|
||||||
|
|
||||||
create_makefile extension_name
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
||||||
#include "token_type.h"
|
|
||||||
|
|
||||||
void Init_hammer_ext(void)
|
|
||||||
{
|
|
||||||
Init_token_type();
|
|
||||||
}
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
||||||
#ifndef HAMMER_EXT__H
|
|
||||||
#define HAMMER_EXT__H
|
|
||||||
|
|
||||||
// ...
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,20 +0,0 @@
|
||||||
#include <ruby.h>
|
|
||||||
#include <hammer.h>
|
|
||||||
|
|
||||||
#include "token_type.h"
|
|
||||||
|
|
||||||
#define DefineHammerInternalConst(name) rb_define_const(mHammerInternal, #name, INT2FIX(name));
|
|
||||||
|
|
||||||
void Init_token_type(void)
|
|
||||||
{
|
|
||||||
VALUE mHammer = rb_define_module("Hammer");
|
|
||||||
VALUE mHammerInternal = rb_define_module_under(mHammer, "Internal");
|
|
||||||
|
|
||||||
DefineHammerInternalConst(TT_NONE);
|
|
||||||
DefineHammerInternalConst(TT_BYTES);
|
|
||||||
DefineHammerInternalConst(TT_SINT);
|
|
||||||
DefineHammerInternalConst(TT_UINT);
|
|
||||||
DefineHammerInternalConst(TT_SEQUENCE);
|
|
||||||
DefineHammerInternalConst(TT_ERR);
|
|
||||||
DefineHammerInternalConst(TT_USER);
|
|
||||||
}
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
||||||
#ifndef HAMMER_EXT_TOKEN_TYPE__H
|
|
||||||
#define HAMMER_EXT_TOKEN_TYPE__H
|
|
||||||
|
|
||||||
void Init_token_type(void);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
require 'hammer/hammer_ext'
|
|
||||||
require 'hammer/internal'
|
require 'hammer/internal'
|
||||||
require 'hammer/parser'
|
require 'hammer/parser'
|
||||||
require 'hammer/parser_builder'
|
require 'hammer/parser_builder'
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue