/[gentoo-x86]/dev-util/ragel/files/ragel-6.6-ruby-1.9.2.patch
Gentoo

Contents of /dev-util/ragel/files/ragel-6.6-ruby-1.9.2.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (hide annotations) (download)
Tue May 22 23:41:01 2012 UTC (11 months, 4 weeks ago) by flameeyes
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +0 -0 lines
FILE REMOVED
Add patch to build with GCC 4.7; respect CXXFLAGS correctly. Closes bugs #394927 and #412347.

(Portage version: 2.2.0_alpha107/cvs/Linux x86_64)

1 flameeyes 1.1 From 50dee06311df4d795b1473935da3cbc661835b73 Mon Sep 17 00:00:00 2001
2     From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= <flameeyes@gmail.com>
3     Date: Thu, 16 Dec 2010 07:44:41 +0100
4     Subject: [PATCH] Fix generated code for Ruby 1.9 compatibility.
5    
6     In Ruby 1.9, the String class no longer works as a C-style array of (8-bit)
7     characters, but supports multiple encoding. While it is obviously a task
8     for the developer to ensure that the data array passed to the
9     Ragel-generated code is in a compatible encoding, this also means that the
10     simple dereference is not going to work:
11    
12     % ruby18 -e 'puts "foo"[0].class'
13     Fixnum
14     % ruby19 -e 'puts "foo"[0].class'
15     String
16    
17     This is easily fixed by calling the #ord method on the dereferenced data,
18     which will provide the ASCII ordinal (or UNICODE codepoint) for the single
19     character.
20    
21     The produced code works correctly both on Ruby 1.8 and 1.9.2.
22     ---
23     ragel/rubycodegen.cpp | 7 +++++--
24     1 files changed, 5 insertions(+), 2 deletions(-)
25    
26     diff --git a/ragel/rubycodegen.cpp b/ragel/rubycodegen.cpp
27     index 5117823..f329587 100644
28     --- a/ragel/rubycodegen.cpp
29     +++ b/ragel/rubycodegen.cpp
30     @@ -307,8 +307,11 @@ string RubyCodeGen::GET_KEY()
31     ret << ")";
32     }
33     else {
34     - /* Expression for retrieving the key, use simple dereference. */
35     - ret << DATA() << "[" << P() << "]";
36     + /* Expression for retrieving the key, use dereference
37     + * and read ordinal, for compatibility with Ruby
38     + * 1.9.
39     + */
40     + ret << DATA() << "[" << P() << "].ord";
41     }
42     return ret.str();
43     }
44     --
45     1.7.3.3
46    

  ViewVC Help
Powered by ViewVC 1.1.13