From 6e685378e0ed0e3c03aec5dce586533cfa39e32b Mon Sep 17 00:00:00 2001 From: Yorick Peterse Date: Tue, 6 May 2014 19:06:04 +0200 Subject: [PATCH] Setup Ragel for JRuby and load things the hard way --- ext/liboga/org/liboga/xml/Lexer.rl | 12 ++++++++++++ lib/oga.rb | 10 ++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/ext/liboga/org/liboga/xml/Lexer.rl b/ext/liboga/org/liboga/xml/Lexer.rl index a42c3bf..4b80ae0 100644 --- a/ext/liboga/org/liboga/xml/Lexer.rl +++ b/ext/liboga/org/liboga/xml/Lexer.rl @@ -26,6 +26,18 @@ public class Lexer extends RubyObject @JRubyMethod public IRubyObject advance_native(ThreadContext context) { + int act = 0; + int cs = 0; + int ts = 0; + int te = 0; + int p = 0; + int pe = 0; + int eof = 0; + int top = 0; + + int[] data = {}; + int[] stack = {}; + %% write init; %% write exec; diff --git a/lib/oga.rb b/lib/oga.rb index 1a74658..213e50b 100644 --- a/lib/oga.rb +++ b/lib/oga.rb @@ -1,11 +1,17 @@ require 'set' -require_relative 'liboga' - require_relative 'oga/xml/lexer' require_relative 'oga/xml/parser' require_relative 'oga/xml/pull_parser' +require_relative 'liboga' + +# FIXME: it looks like this should not be needed but stuff doesn't load without +# it. +if RUBY_ENGINE == 'jruby' + org.liboga.LibogaService.new.basicLoad(JRuby.runtime) +end + require_relative 'oga/xml/node' require_relative 'oga/xml/element' require_relative 'oga/xml/document'