rdx 0.9.0.pre
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.rdx +20 -0
- data/README +19 -0
- data/bin/rdx +7 -0
- data/examples/minimal/.rdx +8 -0
- data/examples/minimal/README +10 -0
- data/examples/minimal/lib/other_conventions.rb +64 -0
- data/examples/minimal/lib/the_basics.rb +94 -0
- data/examples/minimal/lib/using_directives.rb +66 -0
- data/examples/minimal/rakefile +27 -0
- data/examples/ruby-2.0.0-p0/README +7 -0
- data/examples/ruby-2.0.0-p0/install/core/.rdx +6 -0
- data/examples/ruby-2.0.0-p0/install/core/README +19 -0
- data/examples/ruby-2.0.0-p0/install/core/Rakefile +61 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/array.c.diff +166 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/bignum.c.diff +11 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/class.c.diff +36 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/compar.c.diff +11 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/complex.c.diff +301 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/cont.c.diff +65 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/dir.c.diff +147 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/re.rdoc.diff +328 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/security.rdoc.diff +8 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/standard_library.rdoc.diff +0 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/syntax.rdoc.diff +0 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/syntax/assignment.rdoc.diff +160 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/syntax/calling_methods.rdoc.diff +130 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/syntax/control_expressions.rdoc.diff +254 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/syntax/exceptions.rdoc.diff +0 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/syntax/literals.rdoc.diff +54 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/syntax/methods.rdoc.diff +157 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/syntax/miscellaneous.rdoc.diff +91 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/syntax/modules_and_classes.rdoc.diff +161 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/syntax/precedence.rdoc.diff +8 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/syntax/refinements.rdoc.diff +146 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/encoding.c.diff +276 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/enum.c.diff +281 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/enumerator.c.diff +479 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/error.c.diff +143 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/eval.c.diff +47 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/eval_jump.c.diff +23 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/file.c.diff +752 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/gc.c.diff +195 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/hash.c.diff +84 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/iseq.c.diff +354 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/load.c.diff +53 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/marshal.c.diff +98 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/math.c.diff +110 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/numeric.c.diff +103 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/object.c.diff +295 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/pack.c.diff +18 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/parse.y.diff +23 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/proc.c.diff +155 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/random.c.diff +126 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/range.c.diff +49 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/rational.c.diff +312 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/re.c.diff +207 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/ruby.c.diff +21 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/signal.c.diff +67 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/sprintf.c.diff +29 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/string.c.diff +73 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/struct.c.diff +20 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/time.c.diff +691 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/transcode.c.diff +435 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/variable.c.diff +62 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/vm_backtrace.c.diff +164 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/vm_eval.c.diff +99 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/vm_method.c.diff +17 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/vm_trace.c.diff +393 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/.rdx +6 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/README +19 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/Rakefile +53 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/abbrev.rb.diff +77 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/base64.rb.diff +42 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/benchmark.rb.diff +144 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/cmath.rb.diff +52 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/forwardable.rb.diff +150 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/mathn.rb.diff +58 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/matrix.rb.diff +657 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/observer.rb.diff +31 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/optparse.rb.diff +147 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/ostruct.rb.diff +78 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/prime.rb.diff +52 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/pstore.rb.diff +110 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/scanf.rb.diff +100 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/securerandom.rb.diff +144 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/set.rb.diff +637 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/shellwords.rb.diff +66 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/singleton.rb.diff +37 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/tempfile.rb.diff +104 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/thread.rb.diff +38 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/time.rb.diff +140 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/tmpdir.rb.diff +52 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/uri.rb.diff +39 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/uri/common.rb.diff +237 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/weakref.rb.diff +36 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/yaml/store.rb.diff +27 -0
- data/examples/ruby-2.0.0-p0/rakefile +165 -0
- data/lib/rdx.rb +331 -0
- data/lib/rdx/assertions.rb +484 -0
- data/lib/rdx/binding.rb +151 -0
- data/lib/rdx/code_object.rb +598 -0
- data/lib/rdx/comment.rb +338 -0
- data/lib/rdx/convention.rb +1174 -0
- data/lib/rdx/directive.rb +1432 -0
- data/lib/rdx/example.rb +679 -0
- data/lib/rdx/generator.rb +112 -0
- data/lib/rdx/generator/rdoc.rb +1006 -0
- data/lib/rdx/options.rb +359 -0
- data/lib/rdx/plain_text.rb +65 -0
- data/lib/rdx/reporter.rb +421 -0
- data/lib/rdx/ruby_lex.rb +324 -0
- data/lib/rdx/runner.rb +309 -0
- data/lib/rdx/source_file.rb +94 -0
- data/lib/rdx/specification.rb +194 -0
- data/lib/rdx/statement.rb +248 -0
- data/lib/rdx/store.rb +119 -0
- data/lib/rdx/task.rb +361 -0
- data/lib/rdx/text.rb +688 -0
- data/lib/rdx/version.rb +15 -0
- data/rakefile +64 -0
- metadata +203 -0
@@ -0,0 +1,435 @@
|
|
1
|
+
--- core/orig/transcode.c 2015-06-11 07:51:44 +0000
|
2
|
+
+++ core/patched/transcode.c 2015-06-25 17:35:23 +0000
|
3
|
+
@@ -2951,8 +2951,8 @@
|
4
|
+
* can represents exactly the same characters as the given ASCII incompatible encoding.
|
5
|
+
* So, no conversion undefined error occurs when converting between the two encodings.
|
6
|
+
*
|
7
|
+
- * Encoding::Converter.asciicompat_encoding("ISO-2022-JP") #=> #<Encoding:stateless-ISO-2022-JP>
|
8
|
+
- * Encoding::Converter.asciicompat_encoding("UTF-16BE") #=> #<Encoding:UTF-8>
|
9
|
+
+ * Encoding::Converter.asciicompat_encoding("ISO-2022-JP") # > #<Encoding:stateless-ISO-2022-JP>
|
10
|
+
+ * Encoding::Converter.asciicompat_encoding("UTF-16BE") #=> Encoding::UTF_8
|
11
|
+
* Encoding::Converter.asciicompat_encoding("UTF-8") #=> nil
|
12
|
+
*
|
13
|
+
*/
|
14
|
+
@@ -3099,23 +3099,21 @@
|
15
|
+
*
|
16
|
+
* Returns a conversion path.
|
17
|
+
*
|
18
|
+
- * p Encoding::Converter.search_convpath("ISO-8859-1", "EUC-JP")
|
19
|
+
- * #=> [[#<Encoding:ISO-8859-1>, #<Encoding:UTF-8>],
|
20
|
+
- * # [#<Encoding:UTF-8>, #<Encoding:EUC-JP>]]
|
21
|
+
- *
|
22
|
+
- * p Encoding::Converter.search_convpath("ISO-8859-1", "EUC-JP", universal_newline: true)
|
23
|
+
- * or
|
24
|
+
- * p Encoding::Converter.search_convpath("ISO-8859-1", "EUC-JP", newline: :universal)
|
25
|
+
- * #=> [[#<Encoding:ISO-8859-1>, #<Encoding:UTF-8>],
|
26
|
+
- * # [#<Encoding:UTF-8>, #<Encoding:EUC-JP>],
|
27
|
+
+ * Encoding::Converter.search_convpath("ISO-8859-1", "EUC-JP")
|
28
|
+
+ * #=> [[Encoding::ISO_8859_1, Encoding::UTF_8],
|
29
|
+
+ * # [Encoding::UTF_8, Encoding::EUC_JP]]
|
30
|
+
+ *
|
31
|
+
+ * Encoding::Converter.search_convpath("ISO-8859-1", "EUC-JP", universal_newline: true)
|
32
|
+
+ * #=> [[Encoding::ISO_8859_1, Encoding::UTF_8],
|
33
|
+
+ * # [Encoding::UTF_8, Encoding::EUC_JP],
|
34
|
+
* # "universal_newline"]
|
35
|
+
*
|
36
|
+
- * p Encoding::Converter.search_convpath("ISO-8859-1", "UTF-32BE", universal_newline: true)
|
37
|
+
- * or
|
38
|
+
- * p Encoding::Converter.search_convpath("ISO-8859-1", "UTF-32BE", newline: :universal)
|
39
|
+
- * #=> [[#<Encoding:ISO-8859-1>, #<Encoding:UTF-8>],
|
40
|
+
+ * or
|
41
|
+
+ *
|
42
|
+
+ * Encoding::Converter.search_convpath("ISO-8859-1", "UTF-32BE", newline: :universal)
|
43
|
+
+ * #=> [[Encoding::ISO_8859_1, Encoding::UTF_8],
|
44
|
+
* # "universal_newline",
|
45
|
+
- * # [#<Encoding:UTF-8>, #<Encoding:UTF-32BE>]]
|
46
|
+
+ * # [Encoding::UTF_8, Encoding::UTF_32BE]]
|
47
|
+
*/
|
48
|
+
static VALUE
|
49
|
+
econv_s_search_convpath(int argc, VALUE *argv, VALUE klass)
|
50
|
+
@@ -3251,6 +3249,7 @@
|
51
|
+
* Encoding::Converter.new(convpath)
|
52
|
+
*
|
53
|
+
* possible options elements:
|
54
|
+
+ * :rdx: off -
|
55
|
+
* hash form:
|
56
|
+
* :invalid => nil # raise error on invalid byte sequence (default)
|
57
|
+
* :invalid => :replace # replace invalid byte sequence
|
58
|
+
@@ -3335,20 +3334,20 @@
|
59
|
+
*
|
60
|
+
* # Usually, decorators such as newline conversion are inserted last.
|
61
|
+
* ec = Encoding::Converter.new("UTF-16BE", "UTF-8", :universal_newline => true)
|
62
|
+
- * p ec.convpath #=> [[#<Encoding:UTF-16BE>, #<Encoding:UTF-8>],
|
63
|
+
- * # "universal_newline"]
|
64
|
+
+ * ec.convpath #=> [[Encoding::UTF_16BE, Encoding::UTF_8],
|
65
|
+
+ * # "universal_newline"]
|
66
|
+
*
|
67
|
+
* # But, if the last encoding is ASCII incompatible,
|
68
|
+
* # decorators are inserted before the last conversion.
|
69
|
+
* ec = Encoding::Converter.new("UTF-8", "UTF-16BE", :crlf_newline => true)
|
70
|
+
- * p ec.convpath #=> ["crlf_newline",
|
71
|
+
- * # [#<Encoding:UTF-8>, #<Encoding:UTF-16BE>]]
|
72
|
+
+ * ec.convpath #=> ["crlf_newline",
|
73
|
+
+ * # [Encoding::UTF_8, Encoding::UTF_16BE]]
|
74
|
+
*
|
75
|
+
* # Conversion path can be specified directly.
|
76
|
+
* ec = Encoding::Converter.new(["universal_newline", ["EUC-JP", "UTF-8"], ["UTF-8", "UTF-16BE"]])
|
77
|
+
- * p ec.convpath #=> ["universal_newline",
|
78
|
+
- * # [#<Encoding:EUC-JP>, #<Encoding:UTF-8>],
|
79
|
+
- * # [#<Encoding:UTF-8>, #<Encoding:UTF-16BE>]]
|
80
|
+
+ * ec.convpath #=> ["universal_newline",
|
81
|
+
+ * # [Encoding::EUC_JP, Encoding::UTF_8],
|
82
|
+
+ * # [Encoding::UTF_8, Encoding::UTF_16BE]]
|
83
|
+
*/
|
84
|
+
static VALUE
|
85
|
+
econv_init(int argc, VALUE *argv, VALUE self)
|
86
|
+
@@ -3401,7 +3400,7 @@
|
87
|
+
* Returns a printable version of <i>ec</i>
|
88
|
+
*
|
89
|
+
* ec = Encoding::Converter.new("iso-8859-1", "utf-8")
|
90
|
+
- * puts ec.inspect #=> #<Encoding::Converter: ISO-8859-1 to UTF-8>
|
91
|
+
+ * ec.inspect #=> "#<Encoding::Converter: ISO-8859-1 to UTF-8>"
|
92
|
+
*
|
93
|
+
*/
|
94
|
+
static VALUE
|
95
|
+
@@ -3475,9 +3474,9 @@
|
96
|
+
* The result is an array of conversions.
|
97
|
+
*
|
98
|
+
* ec = Encoding::Converter.new("ISO-8859-1", "EUC-JP", crlf_newline: true)
|
99
|
+
- * p ec.convpath
|
100
|
+
- * #=> [[#<Encoding:ISO-8859-1>, #<Encoding:UTF-8>],
|
101
|
+
- * # [#<Encoding:UTF-8>, #<Encoding:EUC-JP>],
|
102
|
+
+ * ec.convpath
|
103
|
+
+ * #=> [[Encoding::ISO_8859_1, Encoding::UTF_8],
|
104
|
+
+ * # [Encoding::UTF_8, Encoding::EUC_JP],
|
105
|
+
* # "crlf_newline"]
|
106
|
+
*
|
107
|
+
* Each element of the array is a pair of encodings or a string.
|
108
|
+
@@ -3570,6 +3569,7 @@
|
109
|
+
* ec.primitive_convert(source_buffer, destination_buffer, destination_byteoffset, destination_bytesize, opt) -> symbol
|
110
|
+
*
|
111
|
+
* possible opt elements:
|
112
|
+
+ * :rdx: off -
|
113
|
+
* hash form:
|
114
|
+
* :partial_input => true # source buffer may be part of larger source
|
115
|
+
* :after_output => true # stop conversion after output before input
|
116
|
+
@@ -3578,6 +3578,7 @@
|
117
|
+
* Encoding::Converter::AFTER_OUTPUT
|
118
|
+
*
|
119
|
+
* possible results:
|
120
|
+
+ * :rdx: off -
|
121
|
+
* :invalid_byte_sequence
|
122
|
+
* :incomplete_input
|
123
|
+
* :undefined_conversion
|
124
|
+
@@ -3643,17 +3644,30 @@
|
125
|
+
* example:
|
126
|
+
* ec = Encoding::Converter.new("UTF-8", "UTF-16BE")
|
127
|
+
* ret = ec.primitive_convert(src="pi", dst="", nil, 100)
|
128
|
+
- * p [ret, src, dst] #=> [:finished, "", "\x00p\x00i"]
|
129
|
+
+ * ret #=> :finished
|
130
|
+
+ * src #=> ""
|
131
|
+
+ * dst #=> "\x00p\x00i"
|
132
|
+
*
|
133
|
+
* ec = Encoding::Converter.new("UTF-8", "UTF-16BE")
|
134
|
+
* ret = ec.primitive_convert(src="pi", dst="", nil, 1)
|
135
|
+
- * p [ret, src, dst] #=> [:destination_buffer_full, "i", "\x00"]
|
136
|
+
+ * ret #=> :destination_buffer_full
|
137
|
+
+ * src #=> "i"
|
138
|
+
+ * dst #=> "\x00"
|
139
|
+
+ *
|
140
|
+
* ret = ec.primitive_convert(src, dst="", nil, 1)
|
141
|
+
- * p [ret, src, dst] #=> [:destination_buffer_full, "", "p"]
|
142
|
+
+ * ret #=> :destination_buffer_full
|
143
|
+
+ * src #=> ""
|
144
|
+
+ * dst #=> "p"
|
145
|
+
+ *
|
146
|
+
* ret = ec.primitive_convert(src, dst="", nil, 1)
|
147
|
+
- * p [ret, src, dst] #=> [:destination_buffer_full, "", "\x00"]
|
148
|
+
+ * ret #=> :destination_buffer_full
|
149
|
+
+ * src #=> ""
|
150
|
+
+ * dst #=> "\x00"
|
151
|
+
+ *
|
152
|
+
* ret = ec.primitive_convert(src, dst="", nil, 1)
|
153
|
+
- * p [ret, src, dst] #=> [:finished, "", "i"]
|
154
|
+
+ * ret #=> :finished
|
155
|
+
+ * src #=> ""
|
156
|
+
+ * dst #=> "i"
|
157
|
+
*
|
158
|
+
*/
|
159
|
+
static VALUE
|
160
|
+
@@ -3777,19 +3791,19 @@
|
161
|
+
* finish method should be used last.
|
162
|
+
*
|
163
|
+
* ec = Encoding::Converter.new("utf-8", "euc-jp")
|
164
|
+
- * puts ec.convert("\u3042").dump #=> "\xA4\xA2"
|
165
|
+
- * puts ec.finish.dump #=> ""
|
166
|
+
+ * ec.convert("\u3042") #=> "\xA4\xA2"
|
167
|
+
+ * ec.finish #=> ""
|
168
|
+
*
|
169
|
+
* ec = Encoding::Converter.new("euc-jp", "utf-8")
|
170
|
+
- * puts ec.convert("\xA4").dump #=> ""
|
171
|
+
- * puts ec.convert("\xA2").dump #=> "\xE3\x81\x82"
|
172
|
+
- * puts ec.finish.dump #=> ""
|
173
|
+
- *
|
174
|
+
+ * ec.convert("\xA4") #=> ""
|
175
|
+
+ * ec.convert("\xA2") #=> "\xE3\x81\x82"
|
176
|
+
+ * ec.finish #=> ""
|
177
|
+
+ *
|
178
|
+
* ec = Encoding::Converter.new("utf-8", "iso-2022-jp")
|
179
|
+
- * puts ec.convert("\xE3").dump #=> "".force_encoding("ISO-2022-JP")
|
180
|
+
- * puts ec.convert("\x81").dump #=> "".force_encoding("ISO-2022-JP")
|
181
|
+
- * puts ec.convert("\x82").dump #=> "\e$B$\"".force_encoding("ISO-2022-JP")
|
182
|
+
- * puts ec.finish.dump #=> "\e(B".force_encoding("ISO-2022-JP")
|
183
|
+
+ * ec.convert("\xE3") #=> "".force_encoding("ISO-2022-JP")
|
184
|
+
+ * ec.convert("\x81") #=> "".force_encoding("ISO-2022-JP")
|
185
|
+
+ * ec.convert("\x82") #=> "\e$B$\"".force_encoding("ISO-2022-JP")
|
186
|
+
+ * ec.finish #=> "\e(B".force_encoding("ISO-2022-JP")
|
187
|
+
*
|
188
|
+
* If a conversion error occur,
|
189
|
+
* Encoding::UndefinedConversionError or
|
190
|
+
@@ -3847,8 +3861,8 @@
|
191
|
+
* It returns the last part of the converted string.
|
192
|
+
*
|
193
|
+
* ec = Encoding::Converter.new("utf-8", "iso-2022-jp")
|
194
|
+
- * p ec.convert("\u3042") #=> "\e$B$\""
|
195
|
+
- * p ec.finish #=> "\e(B"
|
196
|
+
+ * ec.convert("\u3042") #=> "\e$B$\""
|
197
|
+
+ * ec.finish #=> "\e(B"
|
198
|
+
*/
|
199
|
+
static VALUE
|
200
|
+
econv_finish(VALUE self)
|
201
|
+
@@ -3889,6 +3903,7 @@
|
202
|
+
*
|
203
|
+
* primitive_errinfo returns important information regarding the last error
|
204
|
+
* as a 5-element array:
|
205
|
+
+ * :rdx: off -
|
206
|
+
*
|
207
|
+
* [result, enc1, enc2, error_bytes, readagain_bytes]
|
208
|
+
*
|
209
|
+
@@ -3911,28 +3926,28 @@
|
210
|
+
* # \xff is invalid as EUC-JP.
|
211
|
+
* ec = Encoding::Converter.new("EUC-JP", "Shift_JIS")
|
212
|
+
* ec.primitive_convert(src="\xff", dst="", nil, 10)
|
213
|
+
- * p ec.primitive_errinfo
|
214
|
+
- * #=> [:invalid_byte_sequence, "EUC-JP", "UTF-8", "\xFF", ""]
|
215
|
+
+ * ec.primitive_errinfo
|
216
|
+
+ * #=> [:invalid_byte_sequence, "EUC-JP", "Shift_JIS", "\xFF", ""]
|
217
|
+
*
|
218
|
+
* # HIRAGANA LETTER A (\xa4\xa2 in EUC-JP) is not representable in ISO-8859-1.
|
219
|
+
* # Since this error is occur in UTF-8 to ISO-8859-1 conversion,
|
220
|
+
* # error_bytes is HIRAGANA LETTER A in UTF-8 (\xE3\x81\x82).
|
221
|
+
* ec = Encoding::Converter.new("EUC-JP", "ISO-8859-1")
|
222
|
+
* ec.primitive_convert(src="\xa4\xa2", dst="", nil, 10)
|
223
|
+
- * p ec.primitive_errinfo
|
224
|
+
+ * ec.primitive_errinfo
|
225
|
+
* #=> [:undefined_conversion, "UTF-8", "ISO-8859-1", "\xE3\x81\x82", ""]
|
226
|
+
*
|
227
|
+
* # partial character is invalid
|
228
|
+
* ec = Encoding::Converter.new("EUC-JP", "ISO-8859-1")
|
229
|
+
* ec.primitive_convert(src="\xa4", dst="", nil, 10)
|
230
|
+
- * p ec.primitive_errinfo
|
231
|
+
+ * ec.primitive_errinfo
|
232
|
+
* #=> [:incomplete_input, "EUC-JP", "UTF-8", "\xA4", ""]
|
233
|
+
*
|
234
|
+
* # Encoding::Converter::PARTIAL_INPUT prevents invalid errors by
|
235
|
+
* # partial characters.
|
236
|
+
* ec = Encoding::Converter.new("EUC-JP", "ISO-8859-1")
|
237
|
+
* ec.primitive_convert(src="\xa4", dst="", nil, 10, Encoding::Converter::PARTIAL_INPUT)
|
238
|
+
- * p ec.primitive_errinfo
|
239
|
+
+ * ec.primitive_errinfo
|
240
|
+
* #=> [:source_buffer_empty, nil, nil, nil, nil]
|
241
|
+
*
|
242
|
+
* # \xd8\x00\x00@ is invalid as UTF-16BE because
|
243
|
+
@@ -3943,18 +3958,18 @@
|
244
|
+
* # Since the byte is buffered in ec, it is dropped from src.
|
245
|
+
* ec = Encoding::Converter.new("UTF-16BE", "UTF-8")
|
246
|
+
* ec.primitive_convert(src="\xd8\x00\x00@", dst="", nil, 10)
|
247
|
+
- * p ec.primitive_errinfo
|
248
|
+
+ * ec.primitive_errinfo
|
249
|
+
* #=> [:invalid_byte_sequence, "UTF-16BE", "UTF-8", "\xD8\x00", "\x00"]
|
250
|
+
- * p src
|
251
|
+
+ * src
|
252
|
+
* #=> "@"
|
253
|
+
*
|
254
|
+
* # Similar to UTF-16BE, \x00\xd8@\x00 is invalid as UTF-16LE.
|
255
|
+
* # The problem is detected by 4th byte.
|
256
|
+
* ec = Encoding::Converter.new("UTF-16LE", "UTF-8")
|
257
|
+
* ec.primitive_convert(src="\x00\xd8@\x00", dst="", nil, 10)
|
258
|
+
- * p ec.primitive_errinfo
|
259
|
+
+ * ec.primitive_errinfo
|
260
|
+
* #=> [:invalid_byte_sequence, "UTF-16LE", "UTF-8", "\x00\xD8", "@\x00"]
|
261
|
+
- * p src
|
262
|
+
+ * src
|
263
|
+
* #=> ""
|
264
|
+
*
|
265
|
+
*/
|
266
|
+
@@ -4000,20 +4015,24 @@
|
267
|
+
* ec = Encoding::Converter.new("utf-8", "iso-8859-1")
|
268
|
+
* src = "HIRAGANA LETTER A is \u{3042}."
|
269
|
+
* dst = ""
|
270
|
+
- * p ec.primitive_convert(src, dst) #=> :undefined_conversion
|
271
|
+
- * puts "[#{dst.dump}, #{src.dump}]" #=> ["HIRAGANA LETTER A is ", "."]
|
272
|
+
+ * ec.primitive_convert(src, dst) #=> :undefined_conversion
|
273
|
+
+ * src #=> "."
|
274
|
+
+ * dst #=> "HIRAGANA LETTER A is "
|
275
|
+
* ec.insert_output("<err>")
|
276
|
+
- * p ec.primitive_convert(src, dst) #=> :finished
|
277
|
+
- * puts "[#{dst.dump}, #{src.dump}]" #=> ["HIRAGANA LETTER A is <err>.", ""]
|
278
|
+
+ * ec.primitive_convert(src, dst) #=> :finished
|
279
|
+
+ * src #=> ""
|
280
|
+
+ * dst #=> "HIRAGANA LETTER A is <err>."
|
281
|
+
*
|
282
|
+
* ec = Encoding::Converter.new("utf-8", "iso-2022-jp")
|
283
|
+
* src = "\u{306F 3041 3068 2661 3002}" # U+2661 is not representable in iso-2022-jp
|
284
|
+
* dst = ""
|
285
|
+
- * p ec.primitive_convert(src, dst) #=> :undefined_conversion
|
286
|
+
- * puts "[#{dst.dump}, #{src.dump}]" #=> ["\e$B$O$!$H".force_encoding("ISO-2022-JP"), "\xE3\x80\x82"]
|
287
|
+
- * ec.insert_output "?" # state change required to output "?".
|
288
|
+
- * p ec.primitive_convert(src, dst) #=> :finished
|
289
|
+
- * puts "[#{dst.dump}, #{src.dump}]" #=> ["\e$B$O$!$H\e(B?\e$B!#\e(B".force_encoding("ISO-2022-JP"), ""]
|
290
|
+
+ * ec.primitive_convert(src, dst) #=> :undefined_conversion
|
291
|
+
+ * src #=> "\xE3\x80\x82"
|
292
|
+
+ * dst #=> "\e$B$O$!$H".force_encoding("ISO-2022-JP")
|
293
|
+
+ * ec.insert_output "?" # state change required to output "?".
|
294
|
+
+ * ec.primitive_convert(src, dst) #=> :finished
|
295
|
+
+ * src #=> ""
|
296
|
+
+ * dst #=> "\e$B$O$!$H\e(B?\e$B!#\e(B".force_encoding("ISO-2022-JP")
|
297
|
+
*
|
298
|
+
*/
|
299
|
+
static VALUE
|
300
|
+
@@ -4038,7 +4057,7 @@
|
301
|
+
}
|
302
|
+
|
303
|
+
/*
|
304
|
+
- * call-seq
|
305
|
+
+ * call-seq:
|
306
|
+
* ec.putback -> string
|
307
|
+
* ec.putback(max_numbytes) -> string
|
308
|
+
*
|
309
|
+
@@ -4055,10 +4074,10 @@
|
310
|
+
* ec = Encoding::Converter.new("utf-16le", "iso-8859-1")
|
311
|
+
* src = "\x00\xd8\x61\x00"
|
312
|
+
* dst = ""
|
313
|
+
- * p ec.primitive_convert(src, dst) #=> :invalid_byte_sequence
|
314
|
+
- * p ec.primitive_errinfo #=> [:invalid_byte_sequence, "UTF-16LE", "UTF-8", "\x00\xD8", "a\x00"]
|
315
|
+
- * p ec.putback #=> "a\x00"
|
316
|
+
- * p ec.putback #=> "" # no more bytes to put back
|
317
|
+
+ * ec.primitive_convert(src, dst) #=> :invalid_byte_sequence
|
318
|
+
+ * ec.primitive_errinfo #=> [:invalid_byte_sequence, "UTF-16LE", "UTF-8", "\x00\xD8", "a\x00"]
|
319
|
+
+ * ec.putback #=> "a\x00"
|
320
|
+
+ * ec.putback #=> "" # no more bytes to put back
|
321
|
+
*
|
322
|
+
*/
|
323
|
+
static VALUE
|
324
|
+
@@ -4104,10 +4123,10 @@
|
325
|
+
* Encoding::Converter#primitive_convert.
|
326
|
+
*
|
327
|
+
* ec = Encoding::Converter.new("utf-8", "iso-8859-1")
|
328
|
+
- * p ec.primitive_convert(src="\xf1abcd", dst="") #=> :invalid_byte_sequence
|
329
|
+
- * p ec.last_error #=> #<Encoding::InvalidByteSequenceError: "\xF1" followed by "a" on UTF-8>
|
330
|
+
- * p ec.primitive_convert(src, dst, nil, 1) #=> :destination_buffer_full
|
331
|
+
- * p ec.last_error #=> nil
|
332
|
+
+ * ec.primitive_convert(src="\xf1abcd", dst="") #=> :invalid_byte_sequence
|
333
|
+
+ * ec.last_error # > #<Encoding::InvalidByteSequenceError: "\xF1" followed by "a" on UTF-8>
|
334
|
+
+ * ec.primitive_convert(src, dst, nil, 1) #=> :destination_buffer_full
|
335
|
+
+ * ec.last_error #=> nil
|
336
|
+
*
|
337
|
+
*/
|
338
|
+
static VALUE
|
339
|
+
@@ -4129,10 +4148,10 @@
|
340
|
+
* Returns the replacement string.
|
341
|
+
*
|
342
|
+
* ec = Encoding::Converter.new("euc-jp", "us-ascii")
|
343
|
+
- * p ec.replacement #=> "?"
|
344
|
+
+ * ec.replacement #=> "?"
|
345
|
+
*
|
346
|
+
* ec = Encoding::Converter.new("euc-jp", "utf-8")
|
347
|
+
- * p ec.replacement #=> "\uFFFD"
|
348
|
+
+ * ec.replacement #=> "\uFFFD"
|
349
|
+
*/
|
350
|
+
static VALUE
|
351
|
+
econv_get_replacement(VALUE self)
|
352
|
+
@@ -4158,7 +4177,7 @@
|
353
|
+
*
|
354
|
+
* ec = Encoding::Converter.new("utf-8", "us-ascii", :undef => :replace)
|
355
|
+
* ec.replacement = "<undef>"
|
356
|
+
- * p ec.convert("a \u3042 b") #=> "a <undef> b"
|
357
|
+
+ * ec.convert("a \u3042 b") #=> "a <undef> b"
|
358
|
+
*/
|
359
|
+
static VALUE
|
360
|
+
econv_set_replacement(VALUE self, VALUE arg)
|
361
|
+
@@ -4225,13 +4244,13 @@
|
362
|
+
* ec = Encoding::Converter.new("ISO-8859-1", "EUC-JP") # ISO-8859-1 -> UTF-8 -> EUC-JP
|
363
|
+
* begin
|
364
|
+
* ec.convert("\xa0") # NO-BREAK SPACE, which is available in UTF-8 but not in EUC-JP.
|
365
|
+
- * rescue Encoding::UndefinedConversionError
|
366
|
+
- * p $!.source_encoding #=> #<Encoding:UTF-8>
|
367
|
+
- * p $!.destination_encoding #=> #<Encoding:EUC-JP>
|
368
|
+
- * p $!.source_encoding_name #=> "UTF-8"
|
369
|
+
- * p $!.destination_encoding_name #=> "EUC-JP"
|
370
|
+
+ * rescue Encoding::UndefinedConversionError => err
|
371
|
+
* end
|
372
|
+
- *
|
373
|
+
+ * err.source_encoding #=> Encoding::UTF_8
|
374
|
+
+ * err.destination_encoding #=> Encoding::EUC_JP
|
375
|
+
+ * err.source_encoding_name #=> "UTF-8"
|
376
|
+
+ * err.destination_encoding_name #=> "EUC-JP"
|
377
|
+
+ *
|
378
|
+
*/
|
379
|
+
static VALUE
|
380
|
+
ecerr_source_encoding(VALUE self)
|
381
|
+
@@ -4272,10 +4291,10 @@
|
382
|
+
* ec = Encoding::Converter.new("ISO-8859-1", "EUC-JP")
|
383
|
+
* begin
|
384
|
+
* ec.convert("\xa0")
|
385
|
+
- * rescue Encoding::UndefinedConversionError
|
386
|
+
- * puts $!.error_char.dump #=> "\xC2\xA0"
|
387
|
+
- * p $!.error_char.encoding #=> #<Encoding:UTF-8>
|
388
|
+
+ * rescue Encoding::UndefinedConversionError => err
|
389
|
+
* end
|
390
|
+
+ * err.error_char #=> "\xC2\xA0"
|
391
|
+
+ * err.error_char.encoding #=> Encoding::UTF_8
|
392
|
+
*
|
393
|
+
*/
|
394
|
+
static VALUE
|
395
|
+
@@ -4293,11 +4312,11 @@
|
396
|
+
* ec = Encoding::Converter.new("EUC-JP", "ISO-8859-1")
|
397
|
+
* begin
|
398
|
+
* ec.convert("abc\xA1\xFFdef")
|
399
|
+
- * rescue Encoding::InvalidByteSequenceError
|
400
|
+
- * p $! #=> #<Encoding::InvalidByteSequenceError: "\xA1" followed by "\xFF" on EUC-JP>
|
401
|
+
- * puts $!.error_bytes.dump #=> "\xA1"
|
402
|
+
- * puts $!.readagain_bytes.dump #=> "\xFF"
|
403
|
+
+ * rescue Encoding::InvalidByteSequenceError => err
|
404
|
+
* end
|
405
|
+
+ * err # > #<Encoding::InvalidByteSequenceError: "\xA1" followed by "\xFF" on EUC-JP>
|
406
|
+
+ * err.error_bytes #=> "\xA1"
|
407
|
+
+ * err.readagain_bytes #=> "\xFF"
|
408
|
+
*/
|
409
|
+
static VALUE
|
410
|
+
ecerr_error_bytes(VALUE self)
|
411
|
+
@@ -4328,18 +4347,18 @@
|
412
|
+
*
|
413
|
+
* begin
|
414
|
+
* ec.convert("abc\xA1z")
|
415
|
+
- * rescue Encoding::InvalidByteSequenceError
|
416
|
+
- * p $! #=> #<Encoding::InvalidByteSequenceError: "\xA1" followed by "z" on EUC-JP>
|
417
|
+
- * p $!.incomplete_input? #=> false
|
418
|
+
+ * rescue Encoding::InvalidByteSequenceError => err
|
419
|
+
* end
|
420
|
+
+ * err # > #<Encoding::InvalidByteSequenceError: "\xA1" followed by "z" on EUC-JP>
|
421
|
+
+ * err.incomplete_input? #=> false
|
422
|
+
*
|
423
|
+
* begin
|
424
|
+
* ec.convert("abc\xA1")
|
425
|
+
* ec.finish
|
426
|
+
- * rescue Encoding::InvalidByteSequenceError
|
427
|
+
- * p $! #=> #<Encoding::InvalidByteSequenceError: incomplete "\xA1" on EUC-JP>
|
428
|
+
- * p $!.incomplete_input? #=> true
|
429
|
+
+ * rescue Encoding::InvalidByteSequenceError => err
|
430
|
+
* end
|
431
|
+
+ * err # > #<Encoding::InvalidByteSequenceError: incomplete "\xA1" on EUC-JP>
|
432
|
+
+ * err.incomplete_input? #=> true
|
433
|
+
*/
|
434
|
+
static VALUE
|
435
|
+
ecerr_incomplete_input(VALUE self)
|
@@ -0,0 +1,62 @@
|
|
1
|
+
--- core/orig/variable.c 2015-06-11 07:51:44 +0000
|
2
|
+
+++ core/patched/variable.c 2015-06-20 08:57:47 +0000
|
3
|
+
@@ -630,6 +630,9 @@
|
4
|
+
* trace_var :$_, proc {|v| puts "$_ is now '#{v}'" }
|
5
|
+
* $_ = "hello"
|
6
|
+
* $_ = ' there'
|
7
|
+
+ *-- rdx
|
8
|
+
+ * untrace_var :$_
|
9
|
+
+ *++
|
10
|
+
*
|
11
|
+
* <em>produces:</em>
|
12
|
+
*
|
13
|
+
@@ -1482,11 +1485,13 @@
|
14
|
+
* returns a value to be used for that constant. The
|
15
|
+
* following code is an example of the same:
|
16
|
+
*
|
17
|
+
- * def Foo.const_missing(name)
|
18
|
+
- * name # return the constant name as Symbol
|
19
|
+
+ * class Foo
|
20
|
+
+ * def self.const_missing(name)
|
21
|
+
+ * name # return the constant name as Symbol
|
22
|
+
+ * end
|
23
|
+
* end
|
24
|
+
*
|
25
|
+
- * Foo::UNDEFINED_CONST #=> :UNDEFINED_CONST: symbol returned
|
26
|
+
+ * Foo::UNDEFINED_CONST #=> :UNDEFINED_CONST # symbol returned
|
27
|
+
*
|
28
|
+
* In the next example when a reference is made to an undefined constant,
|
29
|
+
* it attempts to load a file whose name is the lowercase version of the
|
30
|
+
@@ -1494,6 +1499,10 @@
|
31
|
+
* <code>fred.rb</code>). If found, it returns the loaded class. It
|
32
|
+
* therefore implements an autoload feature similar to Kernel#autoload and
|
33
|
+
* Module#autoload.
|
34
|
+
+ *
|
35
|
+
+ *-- rdx
|
36
|
+
+ * orig_obj_cnst_missing = Object.method(:const_missing)
|
37
|
+
+ *++
|
38
|
+
*
|
39
|
+
* def Object.const_missing(name)
|
40
|
+
* @looked_for ||= {}
|
41
|
+
@@ -1506,6 +1515,10 @@
|
42
|
+
* return klass if klass
|
43
|
+
* raise "Class not found: #{name}"
|
44
|
+
* end
|
45
|
+
+ *
|
46
|
+
+ *-- rdx
|
47
|
+
+ * RDX::Util.restore_singleton_method Object, orig_obj_cnst_missing
|
48
|
+
+ *++
|
49
|
+
*
|
50
|
+
*/
|
51
|
+
|
52
|
+
@@ -2031,8 +2044,8 @@
|
53
|
+
* modules (example at start of section), unless the <i>inherit</i>
|
54
|
+
* parameter is set to <code>false</code>.
|
55
|
+
*
|
56
|
+
- * IO.constants.include?(:SYNC) #=> true
|
57
|
+
- * IO.constants(false).include?(:SYNC) #=> false
|
58
|
+
+ * File.constants.include?(:SEEK_END) #=> true # Defined in IO class
|
59
|
+
+ * File.constants(false).include?(:SEEK_END) #=> false
|
60
|
+
*
|
61
|
+
* Also see <code>Module::const_defined?</code>.
|
62
|
+
*/
|