diff options
author | Diego Elio Pettenò <flameeyes@gentoo.org> | 2010-12-16 07:07:00 +0000 |
---|---|---|
committer | Diego Elio Pettenò <flameeyes@gentoo.org> | 2010-12-16 07:07:00 +0000 |
commit | 9fce5976641fb70f7aec2a2c9fb5941bf4deac2b (patch) | |
tree | 86ca5b69eea1154165198e69cecd7d1ccb6888fd /dev-util/ragel/files | |
parent | amd64 stable - 348269 (diff) | |
download | gentoo-2-9fce5976641fb70f7aec2a2c9fb5941bf4deac2b.tar.gz gentoo-2-9fce5976641fb70f7aec2a2c9fb5941bf4deac2b.tar.bz2 gentoo-2-9fce5976641fb70f7aec2a2c9fb5941bf4deac2b.zip |
Revision bump ragel to fix the generated state machines to work with Ruby 1.9. Also fix both the new and old (stable) ebuild to run econf just once, as it was broken when adding prefix support.
(Portage version: 2.2.0_alpha8/cvs/Linux x86_64)
Diffstat (limited to 'dev-util/ragel/files')
-rw-r--r-- | dev-util/ragel/files/ragel-6.6-ruby-1.9.2.patch | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/dev-util/ragel/files/ragel-6.6-ruby-1.9.2.patch b/dev-util/ragel/files/ragel-6.6-ruby-1.9.2.patch new file mode 100644 index 000000000000..1408c50a46f2 --- /dev/null +++ b/dev-util/ragel/files/ragel-6.6-ruby-1.9.2.patch @@ -0,0 +1,46 @@ +From 50dee06311df4d795b1473935da3cbc661835b73 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= <flameeyes@gmail.com> +Date: Thu, 16 Dec 2010 07:44:41 +0100 +Subject: [PATCH] Fix generated code for Ruby 1.9 compatibility. + +In Ruby 1.9, the String class no longer works as a C-style array of (8-bit) +characters, but supports multiple encoding. While it is obviously a task +for the developer to ensure that the data array passed to the +Ragel-generated code is in a compatible encoding, this also means that the +simple dereference is not going to work: + +% ruby18 -e 'puts "foo"[0].class' +Fixnum +% ruby19 -e 'puts "foo"[0].class' +String + +This is easily fixed by calling the #ord method on the dereferenced data, +which will provide the ASCII ordinal (or UNICODE codepoint) for the single +character. + +The produced code works correctly both on Ruby 1.8 and 1.9.2. +--- + ragel/rubycodegen.cpp | 7 +++++-- + 1 files changed, 5 insertions(+), 2 deletions(-) + +diff --git a/ragel/rubycodegen.cpp b/ragel/rubycodegen.cpp +index 5117823..f329587 100644 +--- a/ragel/rubycodegen.cpp ++++ b/ragel/rubycodegen.cpp +@@ -307,8 +307,11 @@ string RubyCodeGen::GET_KEY() + ret << ")"; + } + else { +- /* Expression for retrieving the key, use simple dereference. */ +- ret << DATA() << "[" << P() << "]"; ++ /* Expression for retrieving the key, use dereference ++ * and read ordinal, for compatibility with Ruby ++ * 1.9. ++ */ ++ ret << DATA() << "[" << P() << "].ord"; + } + return ret.str(); + } +-- +1.7.3.3 + |